Set column size

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
eliphelet
Posts: 5
Joined: Sun Aug 21, 2011 8:46 am

Set column size

Post by eliphelet »

hi,
i need help!!!!
i created a table in oppenOffice doc from code c#, but i need to set column size, and i dont know how to do that. i tried with:

xPropertySetTable.setPropertyValue("TableColumnSeparators", new uno.Any((short)3000));

but it didn't succeed

does anyone know how to set that?
openOffice 3 on windows 7
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: set column size

Post by hanya »

Code: Select all

            TableColumnSeparator[] separators = new TableColumnSeparator[1];
            separators[0] = new TableColumnSeparator(3000, true);

            xTablePropSet.setPropertyValue("TableColumnSeparators", 
                new uno.Any(typeof(TableColumnSeparator[]), separators));
Check type of TableColumnSeparators property value in the document.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
eliphelet
Posts: 5
Joined: Sun Aug 21, 2011 8:46 am

Re: set column size

Post by eliphelet »

thank you,
i tried it but nothing happened in the doc. do you know any way to set column width?
openOffice 3 on windows 7
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: set column size

Post by hanya »

How many columns do you have in your table? You have to prepare the same number of separator positions with column separators to set.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
eliphelet
Posts: 5
Joined: Sun Aug 21, 2011 8:46 am

Re: set column size

Post by eliphelet »

i have 11 column
did i need to do like that?

Code: Select all

            separators[0] = new TableColumnSeparator(100, true);
            separators[1] = new TableColumnSeparator(100, true);
            separators[2] = new TableColumnSeparator(100, true);
            separators[3] = new TableColumnSeparator(100, true);
            separators[4] = new TableColumnSeparator(200, true);
            separators[5] = new TableColumnSeparator(100, true);
            separators[6] = new TableColumnSeparator(200, true);
            separators[7] = new TableColumnSeparator(200, true);
            separators[8] = new TableColumnSeparator(200, true);
            separators[9] = new TableColumnSeparator(200, true);
            separators[10] = new TableColumnSeparator(200, true);
it doesnt work ;)
openOffice 3 on windows 7
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: set column size

Post by hanya »

You have 11 columns so there are 10 separators in the table.
Position of TableColumnSeparators specifies relative position of the separator in the table. And total width of the table is defined by TableColumnRelativeSum property relatively, its value is 10000 in my case. Each position of the separator should be specified from left side of the table. Here is an example setting:

Code: Select all

(Name)        (Value Type)      (Value)	(AccessMode)
(0)
Position      short             909 	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(1)
Position      short             1818	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(2)
Position      short             2727	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(3)
Position      short             3636	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(4)
Position      short             4545	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(5)
Position      short             5454	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(6)
Position      short             6363	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(7)
Position      short             7272	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(8)
Position      short             8181	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
(9)
Position      short             9090	[ReadWrite]
IsVisible     boolean           True	[ReadWrite]
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
Post Reply