Page 1 of 1

[Solved] VB6-Writer - Column Width TextTable

Posted: Thu Nov 22, 2012 1:26 pm
by dggainza
Hi, I hope someone could help me.

Ive done an application in VB6 to create 00Writer documents
I've got only one problem.
Change columns width.
I have been searching a lot and the only 'code' i get is this one. Everybody say that it works, but not for me.
When I run it, i get an error that says 'Object is recuired'.
I have no acccess to 'otabseps(0).Position ' value

Could anybody heplp me?

Thanks!!

Code: Select all

Dim otabseps() as variant

otabseps = oTable.TableColumnSeparators 'oTable is the table i've created

otabseps(0).Position = oTable.TableColumnRelativeSum * 0.05  'Error Object required
otabseps(1).Position = oTable.TableColumnRelativeSum * 0.15
otabseps(2).Position = oTable.TableColumnRelativeSum * 0.85
otabseps(3).Position = oTable.TableColumnRelativeSum * 0.95

oTable.TableColumnSeparators = otabseps

Re: VB6-Writer - Column Width TextTable

Posted: Thu Nov 22, 2012 2:32 pm
by Villeroy
dggainza wrote:otabseps = oTable.TableColumnSeparators 'oTable is the table i've created
Are you sure?

Re: VB6-Writer - Column Width TextTable

Posted: Thu Nov 22, 2012 3:59 pm
by Charlie Young
Works for me. If you are on 3.3, as your signature says, and since TableColumnSeparators is an array, you may be dealing with this problem.

Re: VB6-Writer - Column Width TextTable

Posted: Thu Nov 22, 2012 4:54 pm
by Villeroy
4 TableColumnSeparators need a table of 5 columns exactly. More columns do not yield the desired effect, less columns raise an error.

Code: Select all

REM  *****  BASIC  *****

Sub Main
oTable=getNewWriterTable(ThisComponent,cols:=5, rows:=3)

otabseps = oTable.TableColumnSeparators 'oTable is the table i've created

otabseps(0).Position = oTable.TableColumnRelativeSum * 0.05  'Error Object required
otabseps(1).Position = oTable.TableColumnRelativeSum * 0.15
otabseps(2).Position = oTable.TableColumnRelativeSum * 0.85
otabseps(3).Position = oTable.TableColumnRelativeSum * 0.95

oTable.TableColumnSeparators = otabseps
End Sub

function getNewWriterTable(doc,cols, rows)
   tbl = doc.createInstance("com.sun.star.text.TextTable")
   tbl.initialize(rows,cols)
   xrange = doc.getText
   xrange.insertTextContent(xrange,tbl,true)
   getNewWriterTable = tbl
end function 

Re: VB6-Writer - Column Width TextTable

Posted: Fri Nov 23, 2012 10:18 am
by dggainza
Charlie Young wrote:Works for me. If you are on 3.3, as your signature says, and since TableColumnSeparators is an array, you may be dealing with this problem.

Thanks a lot!!!

Charlie Young war right.

I update my Oo to 3.4.1 and it works !!!

Thanks again