Mono on OSX: Absolute URIs are not supported
I am trying to run DocX with Mono under OSX. I'm using a recent build,
version 3.2.1. Building with xbuild is successful but the Hello World
example fails at runtime.
Basically, the create document function:
public static DocX Create(string filename) {
// Store this document in memory
MemoryStream ms = new MemoryStream();
// Create the docx package
Package package = Package.Open(ms, FileMode.Create, FileAccess.ReadWrite);
PostCreation(ref package);
DocX document = DocX.Load(ms);
document.filename = filename;
return document;
}
fails with:
Unhandled Exception:
System.ArgumentException: partUri
Parameter name: Absolute URIs are not supported
at System.IO.Packaging.Check.PartUri (System.Uri partUri) [0x00000] in
<filename unknown>:0
at System.IO.Packaging.Package.GetPart (System.Uri partUri) [0x00000] in
<filename unknown>:0
at Novacode.DocX.PopulateDocument (Novacode.DocX document,
System.IO.Packaging.Package package) [0x00000] in <filename unknown>:0
at Novacode.DocX.PostLoad (System.IO.Packaging.Package& package) [0x00000]
in <filename unknown>:0
at Novacode.DocX.Load (System.IO.Stream stream) [0x00000] in <filename
unknown>:0
at Novacode.DocX.Create (System.String filename) [0x00000] in <filename
unknown>:0
where Novacode is the namespace, filename is a relative path with
windows-like backslash, hence @"docs\hello.docx".
Being a beginner in CS/Mono, I don't get why the problem arises and why
the output doesn't detail a more precise location (it's a debug build by
default).
No comments:
Post a Comment