My question conserns changing the position of TablecolumnSeparators in Writer.
This job can be done by a macro in OpenOffice, but for my conviniaence it should be nice if it can be done from VFP.
I work with Visual Fox Pro.
The command COMARRAY is used for objects wich communicate with openoffice to tell that VFP works with '1' based arrays.
The @ sign tells oo that this is a array.
The next to command does not have effect. How to use this?
Code: Select all
lorow.setpropertyvalue("TableColumnSeparators",@seps)
loTable.setpropertyvalue("TableColumnSeparators",@seps)
Using Xray learns that The structure TablecolumnSeparators is not changed.
Here by the complete code:
Code: Select all
*Declaratie variabelen
PUBLIC loOfcMgr, loDesktop, loCoreReflection,loDocument,loTextEnum,loCursEnum,loCursor,loText,loArrayWrapper
PUBLIC loDispatcher,args(2),loPropertyValue
PUBLIC loTable,loTextTable,loTextTables,sep,seps(1),lorow,lorows
PUBLIC nDlnmrs,tableWidthIn,laatste_twee_kolommen,eerste_kolom,rst,per_kolom,numseps
*Maakt Office manager loOfcMgr aan. Deze is public.
Thisformset.Baseform12.Lofuncties1.ooogetservicemanager
COMARRAY(loOfcMgr,10)
*Maakt Desktop aan.
Thisformset.Baseform12.Lofuncties1.ooogetdesktop
COMARRAY(loDesktop,10)
*Document aanmaken en de args daar voor
loCoreReflection = loOfcMgr.createInstance("com.sun.star.reflection.CoreReflection" )
COMARRAY(loCoreReflection,10)
loPropertyValue = CREATEOBJECT("Empty")
loCoreReflection.forName( "com.sun.star.beans.PropertyValue").createobject(@loPropertyValue)
args(1)=loPropertyValue
args(1).name="ReadOnly"
args(1).value=.f.
args(2)=loPropertyValue
args(2).name="MacroExecutionMode"
args(2).value=4
*Nu kan het eingenlijke document worden geladen.
fnm="file:///"+STRTRAN(thuispad, "\","/")+"/LIBRARY/Default_A5.ott"
loDocument = loDesktop.loadComponentFromURL(fnm,"_blank", 0, @args)
COMARRAY(loDocument,10)
*En de tekst.
loText=loDocument.getText() && Create text object
COMARRAY(loText,10)
* Cursor aanmaken
loCursor= loText.createTextCursor()
COMARRAY(loCursor,10)
*Dispatcher aanmaken
loDispatcher = loOfcMgr.createInstance ("com.sun.star.frame.DispatchHelper")
**************aanmaak tabel deel 1*********************
loTable = loDocument.createInstance("com.sun.star.text.TextTable")
loTable.initialize(12, 14)
loCursor=loDocument.getText().createTextCursor()
loDocument.GetText().insertTextContent(loCursor, loTable, False)
loTable.GetCellByPosition(1,1).String="Test"
loTable.GetCellByPosition(0,0).BackColor=8421504
******einde aanmaak tabel*****************************
lorow=CREATEOBJECT("Empty")
lorows=CREATEOBJECT("Empty")
TableName="Tabel1"
nDlnmrs=(loTable.Columns.Count()-3)
tableWidthIn = loTable.TableColumnRelativeSum
laatste_twee_kolommen=1600
eerste_kolom=2000
rst=tableWidthIn-eerste_kolom-laatste_twee_kolommen
per_kolom=ROUND(rst/nDlnmrs,0)
LoRows=loTable.GetRows()
LoRow=LoRows.GetByIndex(0)
numseps=ALEN(lorow.TableColumnSeparators)
PUBLIC sep,seps(numseps),s,i,teller
FOR teller=1 TO numseps
seps(teller)=CREATEOBJECT("Empty")
NEXT teller
FOR teller=1 TO numseps
seps(teller)=Thisform.lofuncties1.ooocreatestruct("com.sun.star.text.TableColumnSeparator")
NEXT teller
FOR i= 1 TO lorows.count
loRow=LoRows.GetByIndex(i-1)
seps=loRow.TableColumnseparators
s=1
sep=seps(s)
sep.Position = eerste_kolom
seps(s)=sep
for s = 2 to (numseps-2)
sep=seps(s)
sep.Position = ROUND((2000+((s-1)*per_kolom)),0)
Seps(s)=sep
next s
s=(numseps-1)
sep=seps(s)
sep.Position = ROUND((tableWidthIn-laatste_twee_kolommen),0)
seps(s)=sep
s=numseps
sep=seps(s)
sep.Position =(tableWidthIn-(laatste_twee_kolommen/2))
seps(s)=sep
[size=150][b][u]* loRow.AddPropertyValue("TableColumnSeparators",@seps) &&This does not work. Is a kwon bug
* loRow.TableColumnseparators=seps &&This does not work because OO sees only they first element of the array
&& and you can not access a single element of "Tablecolumnseparators"
[/u][/b][/size]NEXT i