2016-12-15 61 views
0

我正在将几个word文档合并在一起,最后一个是静态内容,我需要在文档的末尾添加一个日期,但powertool WmlDocument对象似乎不能用于添加文本。我如何添加文字?OPEN XML和Powertools

List <Source> sources = new List<Source>(); 
sources.Add(new Source(report, false)); 
sources.Add(new Source(sig, false)); 
WmlDocument doc = DocumentBuilder.BuildDocument(sources); 
doc.MainDocumentPart.Add() // nothing here works. 
doc.MainDocumentPart.Add(new Text("stuff")); // not working 
doc.MainDocumentPart.Document -- NULL 
doc.SaveAs("blah.docx") //creates doc. 

我不想将文件保存到磁盘然后打开它。

回答

0

我用WordprocessingDocument打开它,并通过该对象模型进行编辑。