In fact, UNO programming is a routine that gets an instance through a document factory and then looks at the functions of the instance's class member functions and sets the available properties. Of course, if it involves interacting with other components or instances, you need to study them carefully.
The code that handles the paragraph is simple and is posted directly.
void Manipulateparagraph (Reference <XTextDocument> xtextdocument) {Reference <XText> XText = xtextdocumen
T->gettext ();
Reference<xtextcursor> xtextcursor (Xtext->createtextcursorbyrange (Xtext->getend ()), UNO_QUERY);
Reference <XPropertySet> Xprops (xtextcursor,uno_query);
Set the left and right spacing sal_int32 margin;
margin = 3000;
any any_margin;
Any_margin <<= margin;
Xprops->setpropertyvalue ("Paraleftmargin", Any_margin);
Set font any fontname;
FontName <<= oustring::createfromascii ("Arial");
Xprops->setpropertyvalue ("Charfontname", FontName);
Set Font color Sal_int32 charcolor = 0x000099;
any any_charcolor;
Any_charcolor <<= CharColor;
Xprops->setpropertyvalue ("CharColor", Any_charcolor);
Set bold any fontweight;
FontWeight <<=::com::sun::star::awt::FontWeight::BOLD;
Xprops->setpropertyvalue ("Charweight", fontweight); Set Font size Sal_int32 Height;
height = 20;
any any_height;
Any_height <<= height;
Xprops->setpropertyvalue ("Charheight", any_height); Xtext->insertstring (Xtext->getend (), "This is a paragraph." We write words here and set paragraph style later. The effect is easy to have.
Some atrributes are setted! ", false);
Center Display Sal_int16 Adjust =:: Com::sun::star::style::P aragraphadjust::P aragraphadjust_center;
any any_adjust;
Any_adjust <<= adjust;
Xprops->setpropertyvalue ("Paraadjust", any_adjust); Xtext->insertcontrolcharacter (Xtext->getend (),:: Com::sun::star::text::controlcharacter::P aragraph_break,
FALSE); }