When I try and ImportNode on the body of the attached document I get the exception “The style must be a paragraph style”. This document opens and works correctly in Word. Thanks.
Please provide the exact code that I can use to reproduce the problem.
Dim uploadDoc As New Document(aFileName)
Dim newDoc As Aspose.Words.Document = CType(uploadDoc.Clone(False), Aspose.Words.Document)
Dim NodeImporter As New Aspose.Words.NodeImporter(uploadDoc, newDoc, Aspose.Words.ImportFormatMode.KeepSourceFormatting)
For Each srcSection As Aspose.Words.Section In uploadDoc
Dim dstSection As Aspose.Words.Node = NodeImporter.ImportNode(srcSection, True)
newDoc.AppendChild(dstSection)
Next
newDoc.Save(aFileName.Replace(".doc", "2.doc"))
Thanks for providing additional info. I have reproduced the problem and logged it to our defect base as issue #3321. We will try to fix it in the next release in 2-3 weeks. I will post a notification here as soon as it will be done.
Best regards,
We have released a new version of Aspose.Words that contains a fix for your issue.
The new version of Aspose.Words is available for download from here.
https://releases.aspose.com/words/net
Best regards.