使用NPOI生成word,想插入一张图片,但是按照例子这么写,生成的word打不开是怎么回事?
XWPFDocument doc = new XWPFDocument();
FileStream gfst = null;
gfst = new FileStream("f:\\pic\\1.jpg", FileMode.Open, FileAccess.Read);
CT_P m_pt = doc.Document.body.AddNewP();
m_pt.AddNewPPr().AddNewJc().val = ST_Jc.center;//段落水平居中
XWPFParagraph gpt = new XWPFParagraph(m_pt, doc);
XWPFRun grt = gpt.CreateRun();
grt.AddPicture(gfst, (int)NPOI.XWPF.UserModel.PictureType.JPEG, "1.jpg", 1000000, 1000000);
gfst.Close();