Problems to access table columns via UNO interface

Helmar Spangenberg hspangenberg at frey.de
Thu Mar 8 08:52:15 PST 2012


Hello list,

I have difficulties to access table columns (and rows) via the UNO interface. 
I have no problems to create a table, but I am not able to manipulate the 
properties of the columns.
Basically my code can be nailed down to

Reference<XMultiServiceFactory> docServices (rDocument, UNO_QUERY_THROW);
Reference<XTextTable> tabelle(docServices->
	createInstance(OUString::createFromAscii("com.sun.star.text.TextTable")),
	UNO_QUERY_THROW);
tabelle->initialize(2, 5);
Reference<XTableColumns> tcols (tabelle->getColumns(), UNO_SET_THROW);
Any pval;
pval <<= tcols->getByIndex(2);
Reference<XPropertySet> s_properties(pval, UNO_QUERY_THROW);

Some debugging showed that the method getByIndex returns an Any with a pointer 
to 0. Since in my case "tcols" seems to be initiated correctly
(tcols->getCount() returns 5 as expected, and tcols->hasElements() returns 
true),
can someone please tell me what is wrong in my code!

I am using LO-3.5 as distributed from www.libreoffice.org; I observe this 
behavior under SuSE Linux 12.1 (64bit).

Thanks in advance,
Helmar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120308/54e375dd/attachment.htm>


More information about the LibreOffice mailing list