Center the text in a table cell

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Center the text in a table cell

Postby nassim1987 » Tue Oct 20, 2015 11:17 am

Hello,

I develop a c++ project that manages OpenOffice 4.1.1 documents. I want to center the text in a table cell. I use for this the following instruction

Code: Select all   Expand viewCollapse view
   Reference<XPropertySet> xTableProps (rTable,UNO_QUERY);
   Any prop;
   prop <<= (long)0x0000FF; // color blue
   xTableProps->setPropertyValue(OUString::createFromAscii("BackColor"),prop);
   Any prop;
   prop <<= (sal_Int32)1;
   xTableProps->setPropertyValue(OUString::createFromAscii("Alignment"),prop);


There is no problem with the "BackColor" property but the "Alignment" property return an error. By default the first row has a center alignment and the others rows have a left alignment.
Could you tell me please the correct property to make a center alignment for all rows and if it's where i find the list the table property name and values

Thank you
OpenOffice 4.1.1 on Windows 7
nassim1987
 
Posts: 9
Joined: Mon Oct 19, 2015 5:15 pm

Re: Center the text in a table cell

Postby nassim1987 » Tue Oct 20, 2015 2:19 pm

I try another think with this code
Code: Select all   Expand viewCollapse view
   Reference<XPropertySet> rCellProperty (rCell,UNO_QUERY);
   rCellProperty->setPropertyValue(OUString::createFromAscii( "HoriJustify"),Any(::com::sun::star::table::CellHoriJustify_CENTER));


I found it in the OpenOffice documentation but i have always the same error (Runtime Library. Debug Error)
OpenOffice 4.1.1 on Windows 7
nassim1987
 
Posts: 9
Joined: Mon Oct 19, 2015 5:15 pm


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest