Aspose.Words Cannot add a style because a style with the same name already exists

I have an old version of Aspose.Words (SubscriptionExpiry>20090707 LicenseVersion>2.2)

A program we haven’t touched for years is failing at the

Public Sub InsertDocumentAtBookmark()

with the following error

Cannot add a style because a style with the same name already exists.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Cannot add a style because a style with the same name already exists.

Source Error:

Line 164:
Line 165:                    ’ This creates a clone of the node, suitable for insertion into the destination document.
Line 166:                    Dim newNode As Node = importer.ImportNode(srcNode, True)
Line 167:
Line 168:                    ’ Insert new node after the reference node.
Source File: C:\Inetpub\taxiinsure\wwwroot\Reports\quote.aspx.vb Line: 166

I understand that this was a known issue

Quote from Aspose forum

"The issues you have found earlier (filed as 3658) have been fixed in this update.

Issue #3658 - “Cannot add a style because a style with the same name already exists” exception occurs during inserting one document into another.

The problem occurs when destination document contains a user defined style with a name of a built in style."

We don’t want to buy the newer version of Aspose because the one we have fulfils all of our requirements.

Could you advise how correct this problem.

Thank you

Jonathan Marsden

Hi Jonathan,

Thanks for your inquiry.

We have fixed a few similar issues in the past and we always encourage our customers to use the latest release versions of Aspose.Words as they contain newly introduced features, enhancements and fixes for issues reported earlier.

So, I would suggest you please upgrade to latest version of Aspose.Words i.e. 13.3.0 and let us know how does it go on your side? You can download it from the following link:
https://releases.aspose.com/words/net

In case the problem still remains, could you please also attach your input Word documents and code here for testing? I will investigate the issue on my side and provide you more information.

PS: I suppose you’re using a very old version of Aspose.Words; unfortunately, we don’t provide support for older released versions of Aspose.Words.

Best regards,