Thanks for your fast reply.
First, I'm using XTextTable (tables in Text-Documents).
Furthermore, I'm using C# not Java (although it's quite similar), but I
don't know "QI". I guess, it casts the xCols element to an XPropertySet.
But that's excactly what doesn't work in my case.
(I know, that the code in my first posting is not complete (I left out
table insertion, initialization, etc.).
cheers
Flo
Andre B Derraik wrote:
Hi,
Sorry, I press the send button...
Here the code. But the "ok" string don't print out!
I don't know what is the problem...
// Get an XIndexAccess of the table columns
XIndexAccess xCols = xTable.getColumns();
// Access the property set of each column the set the OptimalWidth
XPropertySet xColProps = null;
for (int i = 0; i < xCols.getCount(); i++)
{
// Get the Column Property
xColProps = QI.XPropertySet(xCols.getByIndex(i));
if (xColProps != null)
{
// If OptimalWidth is true, the column always keeps its optimal width.
xColProps.setPropertyValue("OptimalWidth", new Boolean(true));
System.out.println("ok");
}
}
Best Regards.
-------------------------------------------------------
André B. Derraik
Consultor
Tecgraf/PUC-Rio http://www.tecgraf.puc-rio.br
[EMAIL PROTECTED] Tel.: +55-21-2512-8428
Florian Limberger wrote:
Hi,
I'm using C# with cli-uno to control OO. I want to set the
column-property "OptimalWidth" of a TextTable to true.
Casting the column to a XPropertySet does not work (invalid cast).
Does anyone know, how to set the OptimalWidth of a whole TextTable ?
cheers
Flo
----------------------------------------------------------------
XTextTable table = null;
XMultiServiceFactory factory = (XMultiServiceFactory)doc;
table = (XTextTable)
factory.createInstance("com.sun.star.text.TextTable");
XTableColumns cols = table.getColumns();
int count = cols.getCount();
for(int i=0;i<cols.getCount();i++)
{
XPropertySet props = (XPropertySet)cols.getByIndex(i).Value;
props.setPropertyValue("OptimalWidth",new uno.Any(true));
}
----------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]