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]

Reply via email to