NPOI WORD

//新建段落     

XWPFParagraph p1 = doc.CreateParagraph();

//对齐方式

 p1.SetAlignment(ParagraphAlignment.LEFT);

p1.SetVerticalAlignment(TextAlignment.AUTO);

//Word边框样式

p1.SetBorderBottom(Borders.DOUBLE);
p1.SetBorderTop(Borders.DOUBLE);
p1.SetBorderRight(Borders.DOUBLE);
p1.SetBorderLeft(Borders.DOUBLE);

p1.SetBorderBetween(Borders.SINGLE);

            //新建文字

            XWPFRun rUserHead = p1.CreateRun();

//文字内容

            rUserHead.SetText("员工 : ");

//颜色

            rUserHead.SetColor("4F6B72");

//大小

            rUserHead.SetFontSize(15);

//是否加粗

            rUserHead.SetBold(true);

//字体

            rUserHead.SetFontFamily("宋体");

//是否有下划线

            //r1.SetUnderline(UnderlinePatterns.DotDotDash);

//位置

            rUserHead.SetTextPosition(20);

//增加换行

rUserHead.AddCarriageReturn();

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页