Free Support Forum - aspose.com

Save method generates error

In a C# project, I instance an Aspose.Words.Document with a docx file, then I insert some other docx in my document and when I call the Save method I get this error: Message=The argument cannot be null or empty string. Parameter name: target.

My code line is : dstDoc.Save(dstDoc.OriginalFileName);

The dstDoc.OriginalFileName exists (I tried also with a string variable ).

Any idea? What is this target parameter?

Regards

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I cannot reproduce the problem on my side using the latest version of Aspose.Words. Could you please attach your input DOCX document and code here for testing? I will check the problem on my side and provide you more information.

Best regards,

The are the main and the inserted files.

The code is quite complex: I replace some content controls with bookmarks and then I replace the bookmarks with the additional document.

This is the error detail

System.ArgumentException was unhandled
Message=The argument cannot be null or empty string.
Parameter name: target
Source=Aspose.Words
ParamName=target
StackTrace:
at ?.?.?(String ?, String ?)
at ?.?..ctor(String id, String type, String target, Boolean isExternal)
at ?.?.?(String ?, String ?, String ?, Boolean ?)
at ?.?.?(String ?, String ?, Boolean ?)
at ?.?.?(String ?, String ?, Boolean ?)
at ?.?.?(String ?)
at ?.?.?()
at ?.?.?()
at ?.?.?(Shape ?, ? ?, ? ?)
at ?.?.?()
at ?.?.?()
at ?.?.?(Shape ?, ? ?)
at ?.?.?(Shape ?)
at ?.?.VisitShapeStart(Shape shape)
at Aspose.Words.Drawing.Shape.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Cell.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Row.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Table.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Cell.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Row.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Table.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Body.Accept(DocumentVisitor visitor)
at ?.?.?(CompositeNode ?)
at ?.?.?()
at ?.?.DoWrite()
at ?.?.?()
at ?.?.?()
at ?.?.?(? ?)
at Aspose.Words.Document.?(Stream ?, String ?, SaveFormat ?)
at Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat)
InnerException:

I also found out that

Ok: I found out the problem: during the docx elaboration, I create some validation errors in the xml.

Thank you for additional information. It is perfect that you already resolve the problem. Please let us know in case of any issue, we will be glad to help you.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Best regards,