【发布时间】:2017-10-02 16:16:12
【问题描述】:
我目前正在使用 OpenXml.Wordprocessing 来处理使用 Word Online 创建的 docx 文件。 使用 Word 保存的 docx 文件(不在线)我对命令没有问题:
using (var wdDocument = WordprocessingDocument.Open(fileName, true))
如果我使用相同的 docx 文件但使用 Word Online 保存,则会出现以下错误: targetUri 参数名称:不支持绝对 URI
使用调试器运行一些测试我注意到有问题的 URI 可能是 word/document.xml,但我不知道我可以通过哪种方式修复这些东西。
这里是堆栈跟踪:
”在 System.IO.Packaging.PackUriHelper.ResolvePartUri (System.Uri sourcePartUri, System.Uri targetUri) [0x0001a] 在 /private/tmp/source-mono-2017-02/bockbuild-2017-02 /profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/WindowsBase/System.IO.Packaging/PackUriHelper.cs:195 \n 在 DocumentFormat.OpenXml.Packaging.OpenXmlPartContainer.LoadReferencedPartsAndRelationships (DocumentFormat.OpenXml .Packaging.OpenXmlPackage openXmlPackage, DocumentFormat.OpenXml.Packaging.OpenXmlPart sourcePart, DocumentFormat.OpenXml.Packaging.RelationshipCollection relationshipCollection, System.Collections.Generic.Dictionary2[TKey,TValue] loadedParts) [0x00098] in <4ab5d094c38a4200ae0a70753476e093>:0 \n at DocumentFormat.OpenXml.Packaging.OpenXmlPart.Load (DocumentFormat.OpenXml.Packaging.OpenXmlPackage openXmlPackage, DocumentFormat.OpenXml.Packaging.OpenXmlPart parent, System.Uri uriTarget, System.String id, System.Collections.Generic.Dictionary2[TKey,TValue] loadedParts) [0x000fc] in :0 \n 在 DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Load () [0x000f5] in :0 \n 在 DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open (System.String path, System.Boolean isEditable, DocumentFormat.OpenXml.Packaging.OpenSettings openSettings) [0x000a6] in :0 \n 在 DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open (System.String path, System.Boolean isEditable) [0x00007] in :0 \n
有什么想法吗?
【问题讨论】: