Export Word documents with Npoi

Source: Internet
Author: User

1Xwpfdocument doc =Newxwpfdocument ();2Xwpfparagraph P0 =Doc. Createparagraph ();3P0. Alignment =Paragraphalignment.left;4 5Xwpfrun R0 =P0. Createrun ();6R0. FontFamily ="Song Body";7R0. FontSize = -;8R0. IsBold =true;9R0. SetText ("password for student's account not logged in");Ten  Onexwpftable table = doc. CreateTable (4,4); ATable. Width = the;//Set Table width -Table. Setcolumnwidth (0, -); -  the  -Xwpfparagraph PIO = table. GetRow (0). Getcell (0). paragraphs[0];//Gets the text box in row No. 0, column No. 0 -Xwpfrun RIO = Pio.createrun ();//Create edits -rio.fontfamily ="Microsoft Ya-Black"; +Rio.fontsize = A; -Rio.isbold =true; +Rio.settext ("0");//Copy A  at  -  -FileStream OUT1 =NewFileStream ("Simpletable.docx", FileMode.Create);//output to default location - Doc. Write (OUT1); -Out1. Close ();

The above is a basic example of exporting a Word document through Npoi.

Export Word documents with Npoi

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.