The attribute details of XWPFRun operations using POI in java, poixwpfrun

Source: Internet
Author: User

The attribute details of XWPFRun operations using POI in java, poixwpfrun

XWPFRun is a text object in XWPFDocument)

 

Create Document Object

XWPFDocument docxDocument = new XWPFDocument ();

Create paragraph object

XWPFParagraph paragraphX = docxDocument. createParagraph ();

Create a Text object (today's main character: XWPFRun)
XWPFRun runX = paragraphX. createRun ();

 

// Default value: (wps)/ (office2016. setText... "); runX. setBold (false); // bold runX. setCapitalized (false); // I do not know what this attribute is doing. // runX. setCharacterSpacing (5); // This attribute returns the error runX. setColor ("BED4F1"); // sets the color -- hexadecimal runX. setDoubleStrikethrough (false); // double strikethrough runX. setEmbossed (false); // embossed font-the effect is similar to that of the mark (floating shadow). // runX. setFontFamily (""); // font runX. setFontFamily (" 文 ", FontCharRange. cs); // font, range ---- effect unknown runX. setFontSize (14); // font size runX. setImprinted (false); // imprint (floating shadow) --- effect and relief are similar to runX. setItalic (false); // italic (font skew) // runX. setKerning (1); // padding adjustment ---- this seems to have no effect on runX. setShadow (true); // shadow --- slightly effect (the shadow is not obvious) // runX. setSmallCaps (true); // small stock ------ unclear effect // runX. setStrike (true); // Delete (discard) runX. setStrikeThrough (false); // strikethrough (new Strike) // runX. setSubscript (VerticalAlign. SUBSCRIPT); // SUBSCRIPT (now this run becomes a SUBSCRIPT) --- enumeration // runX. setTextPosition (5); // font position (unknown effect) // runX. setUnderline (UnderlinePatterns. DASH_LONG); // underlines of various types (enumeration)
// RunX0.addBreak (); // operations similar to line feed (html br tag)
RunX0.addTab (); // tab key
RunX0.addCarriageReturn (); // enter the key

Note: addTab () and addCarriageReturn () are related to the sequence in which setText () is used: for example, run addTab first and then write Text. This is the Table of the current Text, the opposite is the Tab effect for the next run Text.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.