Center the text in a table cell

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
nassim1987
Posts: 9
Joined: Mon Oct 19, 2015 5:15 pm

Center the text in a table cell

Post by nassim1987 »

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

   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

Post by nassim1987 »

I try another think with this code

Code: Select all

	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
Post Reply