[Solved] VB6-Writer - Column Width TextTable

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
dggainza
Posts: 2
Joined: Thu Nov 22, 2012 12:55 pm

[Solved] VB6-Writer - Column Width TextTable

Post 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
Last edited by dggainza on Fri Nov 23, 2012 10:25 am, edited 2 times in total.
OpenOffice 3.4.1 on Windows XP sp3
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: VB6-Writer - Column Width TextTable

Post by Villeroy »

dggainza wrote:otabseps = oTable.TableColumnSeparators 'oTable is the table i've created
Are you sure?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Charlie Young
Volunteer
Posts: 1559
Joined: Fri May 14, 2010 1:07 am

Re: VB6-Writer - Column Width TextTable

Post 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.
Apache OpenOffice 4.1.1
Windows XP
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: VB6-Writer - Column Width TextTable

Post 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 
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
dggainza
Posts: 2
Joined: Thu Nov 22, 2012 12:55 pm

Re: VB6-Writer - Column Width TextTable

Post 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
OpenOffice 3.4.1 on Windows XP sp3
Post Reply