使用 OpenXml 从内存中读取 WordprocessingDocument 并保存到 AddAlternativeFormatImportPart
这项工作正常:
MemoryStream ms = //do some in memory on WordprocessingDocument ;
AlternativeFormatImportPart chunk = mainPart.AddAlternativeFormatImportPart(
AlternativeFormatImportPartType.WordprocessingML,
altChunkId);
using(var fs = new FileStream(@"c:\\temp\\1.docx", FileMode.Create, FileAccess.ReadWrite,FileShare.Read))
ms.WriteTo(fs);
using(FileStream fs = new FileStream(@"c:\\temp\\1.docx", FileMode.Open, FileAccess.Read))
chunk.FeedData(fs);
无法正确从内存流 WordprocessingDocument 读取并使用 OpenXml 保存到另一个上的 AddAlternativeFormatImportPart 而不保存到光盘,
MemoryStream ms = //do some in memory on WordprocessingDocument ;
chunk.FeedData(fs);
怎么办?
这对我有帮助
MemoryStream ms = //do some in memory on WordprocessingDocument ;
ms.Seek(0, SeekOrigin.Begin);
chunk.FeedData(ms);
this work fine:
MemoryStream ms = //do some in memory on WordprocessingDocument ;
AlternativeFormatImportPart chunk = mainPart.AddAlternativeFormatImportPart(
AlternativeFormatImportPartType.WordprocessingML,
altChunkId);
using(var fs = new FileStream(@"c:\\temp\\1.docx", FileMode.Create, FileAccess.ReadWrite,FileShare.Read))
ms.WriteTo(fs);
using(FileStream fs = new FileStream(@"c:\\temp\\1.docx", FileMode.Open, FileAccess.Read))
chunk.FeedData(fs);
can't correct read from memory stream WordprocessingDocument and save to AddAlternativeFormatImportPart on another using OpenXml without save to disc
MemoryStream ms = //do some in memory on WordprocessingDocument ;
chunk.FeedData(fs);
how it do?
it's help me
MemoryStream ms = //do some in memory on WordprocessingDocument ;
ms.Seek(0, SeekOrigin.Begin);
chunk.FeedData(ms);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论