Browse Source

add word export test

master
yangxiaodong 8 years ago
parent
commit
86f966d457
  1. 15
      Code/Npoi.Samples.CreateNewSpreadsheet/Program.cs
  2. 0
      Code/Npoi.Samples.CreateNewSpreadsheet/newbook.core.docx

15
Code/Npoi.Samples.CreateNewSpreadsheet/Program.cs

@ -80,6 +80,21 @@ namespace Npoi.Samples.CreateNewSpreadsheet
Console.WriteLine("Excel Done"); Console.WriteLine("Excel Done");
var newFile2 = @"newbook.core.docx";
using (var fs = new FileStream(newFile2, FileMode.Create, FileAccess.Write)) {
XWPFDocument doc = new XWPFDocument();
var p0 = doc.CreateParagraph();
p0.Alignment = ParagraphAlignment.LEFT;
XWPFRun r0 = p0.CreateRun();
r0.FontFamily = "宋体";
r0.FontSize = 18;
r0.IsBold = true;
r0.SetText("未登录过学生的账号密码");
doc.Write(fs);
}
Console.WriteLine("Word Done");
} }
} }
} }

0
Code/Npoi.Samples.CreateNewSpreadsheet/newbook.core.docx

Loading…
Cancel
Save