'System.ArgumentException: duplicate' while saving some documents

Hello, we started to get bugs while converted 2 files (see in attachment) from MS WORD to html format. The error occures when we call method: Aspose.Words.Document.Save


The exception message is:

pose exception:System.ArgumentException: duplicate

в x6c95d9cf46ff5f25.x09ce2c02826e31a6.xd6b6ed77479ef68c(Int32 xba08ce632055a1d9, Object xbcea506a33cf9111)

в Aspose.Words.StyleCollection.xd6b6ed77479ef68c(Style x44ecfea61c937b8e)

в Aspose.Words.StyleCollection.x81f78ebaaa78ed06(x7f4fa84f489f40ab x0f7b23d1c393aed9, Style x464349d05eb2b57c)

в Aspose.Words.StyleCollection.x81f78ebaaa78ed06(Style x464349d05eb2b57c)

в Aspose.Words.StyleCollection.xf21e14e2c9db279a(StyleIdentifier xa3be2ccad541ab25, Boolean x988fcf605f8efa7e)

в Aspose.Words.StyleCollection.xca86a79e7ad537a5()

в Aspose.Words.Document.EnsureMinimum()

в x13cd31bb39e0b7ea.xcc0b5baa75272714.VisitDocumentStart(Document doc)

в Aspose.Words.Document.x2449520719b1e37e(DocumentVisitor x672ff13faf031f3d)

в Aspose.Words.CompositeNode.xf7ae36cd24e0b11c(DocumentVisitor x672ff13faf031f3d)

в Aspose.Words.Document.Accept(DocumentVisitor visitor)

в x13cd31bb39e0b7ea.xcc0b5baa75272714.x18dfca7c5fd2402f(x8556eed81191af11 x5ac1382edb7bf2c2)

в Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)

в Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)

в
Interfax.ASOI.Services.ISBMG30.Support.Files.ConvertWordToHtml(String
pathToDoc, String pathToHtml, Boolean convertTables) в
C:\NEWASOI\ASOI\Source\ASOI.Loader\ISBMG30\Support\Files.cs:строка 212


The code rhat calls this method is here:

LoadOptions Options = new LoadOptions();
Aspose.Words.Document doc = new Document(pathToDoc, Options);
doc.Sections[0].HeadersFooters.Clear();

nodes = doc.GetChildNodes(NodeType.Run, true);
foreach (Run node in nodes)
{

node.Text = node.Text.Replace("\v", “\r”);
if (node.PreviousSibling == null || node.PreviousSibling.NodeType == NodeType.Paragraph)
{
if (node.ParentParagraph.ParagraphFormat.FirstLineIndent > 0)
{
if (node.Text[0] != ‘\t’)
{
node.ParentParagraph.ParagraphFormat.FirstLineIndent = 0;
node.Text = “###%tab%###” + node.Text;
}
}
}
}
SaveOptions so = SaveOptions.CreateSaveOptions(SaveFormat.Html);
doc.Save(pathToHtml + “\html.htm”, so);

Kind Regards.

Hi Alexey,


Thanks for your inquiry.

Perhaps you’re using an older version of Aspose.Words; as with Aspose.Words for .NET 13.9.0, I was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. 13.9.0. You can download it from the following link:

I hope, this helps.

Best regards,

Awais, thank You!

I have downloaded the new version and all works good!

Best Regards.

Hi Alexey,


Thanks for your feedback. It’s great that the latest version of Aspose.Words resolves your problem. Please let us know any time you have any further queries.

Best regards,