0
我使用OPENXML如何使用OPENXML
這裏創建Word文檔形式的MemoryStream合併多個word文檔形式的MemoryStream是我使用的代碼:
System.IO.MemoryStream ms1=new MemoryStream();
using (var mainDoc = WordprocessingDocument.Create(ms1, WordprocessingDocumentType.Document))
{
mainDoc.AddMainDocumentPart();
mainDoc.MainDocumentPart.Document =
new Document(new Body(new Paragraph(new Run(new Text("Hello World 1!")))));
mainDoc.MainDocumentPart.Document.Save();
}
System.IO.MemoryStream ms2 = new MemoryStream();
using (var mainDoc = WordprocessingDocument.Create(ms2,WordprocessingDocumentType.Document))
{
mainDoc.AddMainDocumentPart();
mainDoc.MainDocumentPart.Document =
new Document(new Body(new Paragraph(new Run(new Text("Hello World 2!")))));
mainDoc.MainDocumentPart.Document.Save();
}
我可以一個的MemoryStream保存的FileStream,並保存到.docx文件比 打開它,但我怎麼能合併兩個MemoryStream文檔作爲一個單詞文件在MemoryStream或FileStream比保存它?
你看過[OpenXmlPowerTools](https://github.com/OfficeDev/Open-Xml-PowerTools)嗎?有關[Eric White的網站]的更多信息(http://ericwhite.com/blog/blog/documentbuilder-developer-center/) – erdomke