无法打开使用NPOI编写的生成的Word文档。
代码:
public void word_sample()
{
FileStream input = new FileStream ("C:\\charan\\Input.docx", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
FileStream output=new FileStream ("C:\\charan\\output.docx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
XWPFDocument wordDocument = new XWPFDocument(input);
IList<XWPFTable> t=wordDocument.GetTables();
try
{
t[1].GetRow(1).GetCell(1).SetText("1,1");
wordDocument.Write(output);
output.Close();
input.Close();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
Console.ReadLine();
}
}