public static xwpfdocument createddtzdtable (DataObject para) throws Appexception, IOException {boolean isxz = Para.get Boolean ("Isxz", true);/whether to add a Boolean ISSYQ = Para.getboolean ("Issyq", false);//Whether the trial period is a String nd = para.getstring ("nd", "
");
String tzxh = para.getstring ("Tzxh", "");
String DWMC = para.getstring ("DWMC", "");//"Integrated free Trade Zone Development Center String TZRQ = para.getdatetostring (" Tzrq "," yyyy year mm month DD Day "); String CSDWMC = para.getstring ("CSDWMC", "");//"Service Promotion Bureau, Social Affairs Bureau, Sci-Tech economic Operation Bureau" string DGRQ = Para.getdatetostring ("Dgrq", "
YYYY year mm month DD Day ");
Datastore ryds = Para.getdatastore ("Ryds", New Datastore ());
String xminzw = "";//The body of the name int rs = 0;//number string rsstr = "";
if (Ryds!=null && ryds.rowcount () >0) {xminzw = ryds.getstring (0, "XM");
rs = Ryds.rowcount ();
Rsstr = Gautil.getnumbercap (RS);
} xwpfdocument doc = new xwpfdocument ();
CTSECTPR SECTPR = Doc.getdocument (). GetBody (). ADDNEWSECTPR ();
Ctpagemar Pagemar = Sectpr.addnewpgmar (); Pagemar.setleft (BigInteger.valueof (1587L));//parameter/567= actual cm pagemar.settop (biginteger.valueof (2097L));
Pagemar.setright (biginteger.valueof (1587L));
Pagemar.setbottom (biginteger.valueof (2097L));
Title Xwpfparagraph Ptitle = Doc.createparagraph ();
Setfontformat (Ptitle, "Human resources Management Department", 30, "founder Small Standard Song Simplified", True, Paragraphalignment.center, false, NULL);
Ptitle.setalignment (Paragraphalignment.center);
Xwpfrun run = Ptitle.createrun ();//A xwpfrun represents an area with the same attributes.
Run.settext ("Department of Human Resources Management");
Run.setbold (TRUE);
Run.setfontfamily ("founder Small Standard Song Simplified"), only to the number, English function run.setfontsize (30);
Run.setcolor ("FF0000");
Run.setunderline (Underlinepatterns.single); CTRPR RPR = run.getctr (). ISSETRPR ()?
Run.getctr (). GETRPR (): Run.getctr (). ADDNEWRPR (); ctfonts fonts = rpr.issetrfonts ()?
Rpr.getrfonts (): Rpr.addnewrfonts ();
Fonts.seteastasia ("Founder of the Small Standard song");//Chinese character Font fonts.setascii ("founder Small Standard song)"//Digital font fonts.sethansi ("Founder Small Standard Song");/parenthesis Symbol font
Annual, serial number xwpfparagraph Pndxh = Doc.createparagraph ();Setfontformat (Pndxh, "(" +nd+ ")" +string.valueof (TZXH) + "number", 16, "italics", false, Paragraphalignment.right, false, NULL);
Text title: Post Deployment notice xwpfparagraph PZWBT = Doc.createparagraph ();
Setfontformat (PZWBT, "Post deployment Notice", 22, "Wenxing song", False, Paragraphalignment.center, false, NULL);
Body content Xwpfparagraph PZW = Doc.createparagraph (); Add person if (ISXZ) {//Unit name Setfontformat (PZW, DWMC, 16, "italics", false, Paragraphalignment.left, False, Underlinepattern
S.single);
Setfontformat (PZW, ":", 16, "italics", false, Paragraphalignment.left, true, null);
Content Setfontformat (PZW, "due to the work needs, according to the Post appointment management method, determined by the study:", 16, "imitation", False, Paragraphalignment.left, true, null);
Setfontformat (PZW, "", 16, "imitation", false, Paragraphalignment.left, false, NULL);
Setfontformat (PZW, XMINZW, 16, "imitation", false, Paragraphalignment.left, false, Underlinepatterns.single);
if (rs>1) {Setfontformat (PZW, "et", 16, "imitation", false, Paragraphalignment.left, false, NULL); Setfontformat (PZW, string.valueof (RSSTR), 16, "imitation", false, Paragraphalignment.left, false, Underlinepatterns.single);
Setfontformat (PZW, "name", 16, "imitation", false, Paragraphalignment.left, false, NULL);
Setfontformat (PZW, "Comrade to you work", 16, "imitation", false, Paragraphalignment.left, false, NULL);
if (ISSYQ) {//Probationary period Setfontformat (PZW, "(", 16, "imitation", false, Paragraphalignment.left, false, NULL);
Setfontformat (PZW, "probationary period 2 months", 16, "XXFarEastFont-Xingkai", False, Paragraphalignment.left, false, NULL);
Setfontformat (PZW, ")", 16, "imitation", false, Paragraphalignment.left, false, NULL); } setfontformat (PZW, ". Please handle the relevant formalities accordingly.
", 16," imitation ", False, Paragraphalignment.left, true, null); Setfontformat (PZW, "hereby inform.)
", 16," imitation ", False, Paragraphalignment.left, true, null);
Run = Pzw.createrun (); Run.addbreak ();//linefeed Run.addbreak ()//Line break Setfontformat (PZW, "" +tzrq, 16, "imitation", FAL
SE, paragraphalignment.left, true, null); Mobilize personnel}else{//unit name Setfontformat (PZW, DWMC, 16, "italics", false, ParagraphaLignment.
Left, false, Underlinepatterns.single);
Setfontformat (PZW, ":", 16, "italics", false, Paragraphalignment.left, true, null);
Content Setfontformat (PZW, "due to the work needs, according to the Post appointment management method, determined by the study:", 16, "imitation", False, Paragraphalignment.left, true, null);
Setfontformat (PZW, "", 16, "imitation", false, Paragraphalignment.left, false, NULL);
Setfontformat (PZW, XMINZW, 16, "imitation", false, Paragraphalignment.left, false, Underlinepatterns.single);
if (rs>1) {Setfontformat (PZW, "et", 16, "imitation", false, Paragraphalignment.left, false, NULL);
Setfontformat (PZW, string.valueof (RSSTR), 16, "imitation", false, Paragraphalignment.left, false, Underlinepatterns.single);
Setfontformat (PZW, "name", 16, "imitation", false, Paragraphalignment.left, false, NULL); Setfontformat (PZW, "Comrade to your work, in the" +dgrq+ "before reporting. Please handle the relevant formalities accordingly.
", 16," imitation ", False, Paragraphalignment.left, true, null); Setfontformat (PZW, "hereby inform.)
", 16," imitation ", False, Paragraphalignment.left, true, null);
Run = Pzw.createrun (); Run.addbreak ()/Line Wrap
Setfontformat (PZW, "" +tzrq, 16, "imitation", False, Paragraphalignment.left, true, null);
Run = Pzw.createrun (); Run.addbreak ()//newline if (csdwmc!=null &&! "".
Equals (CSDWMC)) {Setfontformat (PZW, "cc:", 16, "imitation", true, Paragraphalignment.left, false, NULL);
string[] Csdwmclist = Csdwmc.split (","); for (int i=0; i<csdwmclist.length; i++) {if (i<csdwmclist.length-1) {Setfontformat (PZW, csdwmclist[i]+ ",",
16, "imitation", false, Paragraphalignment.left, false, NULL); }else if (i==csdwmclist.length-1) {Setfontformat (PZW, csdwmclist[i]+).
", 16," imitation ", False, Paragraphalignment.left, true, null);
}else{}} Run = Pzw.createrun ();
Run.addbreak ();//newline} setfontformat (PZW, "(Attached list)", 16, "imitation", False, Paragraphalignment.left, true, null);
Form xwpftable table = doc.createtable (Ryds.rowcount () +1, 4);
Table width Cttblpr tablepr = Table.getcttbl (). ADDNEWTBLPR (); Cttblwidth width = TABLEPR.ADDNEWTBLW ();
WIDTH.SETW (biginteger.valueof (4000));
Tablepr = Table.getcttbl (). ADDNEWTBLPR ();
width = TABLEPR.ADDNEWTBLW ();
WIDTH.SETW (Biginteger.valueof (10000));
Set height table.getrow (0). SetHeight (400);
for (int i=1; i<table.getnumberofrows (); i++) {Table.getrow (i). SetHeight (510);
}//table list<xwpftablecell> tablecells = Table.getrow (0). Gettablecells ();
Xwpftablecell cell = tablecells.get (0);
Xwpfparagraph ptable = new Xwpfparagraph (CELL.GETCTTC (). ADDNEWP (), cell);
Setfontformat (ptable, "serial number", 14, "Blackbody", False, Paragraphalignment.center, false, NULL);
Cell = Tablecells.get (1);
ptable = new Xwpfparagraph (CELL.GETCTTC (). ADDNEWP (), cell);
Setfontformat (ptable, "name", 14, "Blackbody", False, Paragraphalignment.center, false, NULL);
Cell = Tablecells.get (2);
ptable = new Xwpfparagraph (CELL.GETCTTC (). ADDNEWP (), cell);
if (ISXZ) {Setfontformat (ptable, "post", 14, "Blackbody", False, Paragraphalignment.center, false, NULL);
}else{Setfontformat (ptable, "original post", 14, "Blackbody", False, Paragraphalignment.center, false, NULL);
Cell = Tablecells.get (3);
ptable = new Xwpfparagraph (CELL.GETCTTC (). ADDNEWP (), cell);
Setfontformat (ptable, "remarks", 14, "bold", False, Paragraphalignment.center, false, NULL);
Run = Ptable.createrun (); Ptable.setalignment (paragraphalignment.center);//Center//ptable.setverticalalignment (Textalignment.center);
Center//Run.settext ("Remarks");
for (int i=0; I<ryds.rowcount (); i++) {tablecells = Table.getrow (i+1). Gettablecells ();
Cell = tablecells.get (0);
ptable = new Xwpfparagraph (CELL.GETCTTC (). ADDNEWP (), cell);
Setfontformat (ptable, string.valueof (i+1), 12, "imitation", false, Paragraphalignment.center, false, NULL);
Cell = Tablecells.get (1);
ptable = new Xwpfparagraph (CELL.GETCTTC (). ADDNEWP (), cell);
Setfontformat (ptable, ryds.getstring (i, "XM"), 12, "imitation", false, Paragraphalignment.center, false, NULL);
Cell = Tablecells.get (2); ptable = new XWPFParagraph (CELL.GETCTTC (). ADDNEWP (), cell);
Setfontformat (ptable, ryds.getstring (i, "GW"), 12, "imitation", false, Paragraphalignment.left, false, NULL);
Cell = Tablecells.get (3);
ptable = new Xwpfparagraph (CELL.GETCTTC (). ADDNEWP (), cell);
Setfontformat (ptable, ryds.getstring (i, "BZ"), 12, "imitation", false, Paragraphalignment.left, false, NULL);
}//FileOutputStream out; try {//out = new FileOutputStream ("c:/users/xbx/desktop/personnel transfer notice. docx");//Doc.write (out);//Out.close ();//
catch (IOException e) {//E.printstacktrace ();//} return doc; /** * Sets the format of the content when Word is generated * @author xbx * @date 2018-01-15 * @param paragraph paragraph * @param content text * param fontsize Font size * @param fonttypestyle font type * @param isbold bold * @param horizontalposition horizontal position * @param Isaddbreak * @param underlinestytle under the line change style * * public static void Setfontformat (xwpfparagraph paragraph, String Content, int fontsize, String fonttypestyle, BooleAn isbold, Paragraphalignment horizontalposition, Boolean isaddbreak, Underlinepatterns underlinestytle) {//Horizontal position if (ho Rizontalposition!=null &&! "".
Equals (HorizontalPosition)) {paragraph.setalignment (horizontalposition);
Xwpfrun run = Paragraph.createrun ();//A xwpfrun represents an area with the same attributes.
Run.settext (content);//Contents run.setfontsize (fontsize);//font size//newline if (isaddbreak) {run.addbreak (); //Underline style if (Underlinestytle!=null &&! "".
Equals (Underlinestytle)) {run.setunderline (underlinestytle);
}//whether to add coarse run.setbold (isbold); Font if (fonttypestyle!=null &&! "".
Equals (Fonttypestyle)) {CTRPR RPR = run.getctr (). ISSETRPR ()? Run.getctr (). GETRPR (): Run.getctr (). ADDNEWRPR (); ctfonts fonts = rpr.issetrfonts ()?
Rpr.getrfonts (): Rpr.addnewrfonts (); Fonts.seteastasia (Fonttypestyle);//Kanji Font fonts.setascii (fonttypestyle);//Digital Font fonts.sethansi (fonttypestyle);//enclosed symbols, etc. fonts}}