We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to compare two styles

Hello,

Is it possible to compare two document styles?
Several styles in the document have different names but are the same by content (font, paragraph settings). We want to decrease a number of styles used in a document so we need to find the equal styles and delete all of them except one.

Best regards, Evgeniy

Hi Evgeniy,


Thanks for your inquiry.

I’m afraid there is no built-in way to compare or delete styles from the document at the moment. I have linked your requests to the appropriate issues. We will inform you as soon as there are any developments.

In the mean time you may be able to work around a solution by comparing the styles through the use of a byte array as demonstrated in the code here. The technique seems fairly reliable. Secondly, you cannot remove a style from a document, however you could change any content using a duplicate style to using just one style and then inserting all of the document content into a new document. This should result in only the one style appearing in the document.

This does sound like a bit of work though, I would highly suggest waiting for the original features to be implemented in the API instead.

Thanks,

Hi Adam,

Thanks a lot for a reply.

I agree the solution provided is not very comfortable in usage. So we are waiting for the features in the API. I would expect at least two methods in class StyleCollection: remove (Style style) and compare (Style style1, Style style2).

Best regards, Evgeniy

Hi Evgeniy,


Thanks for your inquiry.

Yes we will add such methods to the Aspose.Words API. Just to clarify, what would you like to see returned by the proposed method StyleCollection.Compare(Style, Style)? In other words, could you clarify what sort of comparison and result are you looking for?

Thanks,

Hi Adam,

Maybe method equals() or areEqual() will be more accurate by name and meaning. The method returns true, if all content of styles is the same (paragraph format, font, text alignment, etc).

Best regards, Evgeniy

Hi Evgeniy,


Thanks, we will make sure this functionality is possible with the improvement to the API. We will inform you as soon as there are any developments.

Thanks,

The issues you have found earlier (filed as WORDSNET-2304) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(46)