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

Free Support Forum - aspose.com

Style names are changed after saving DOCX to HTML and saving back

Hi,

When saving a DOCX file to HTML, then save it back for a couple of times, I noticed some of the style names became very weird.

Code:
var doc = new Document(@".\styles.docx");
var htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.CssStyleSheetType = CssStyleSheetType.External;
doc.Save(@".\stylesOut.html", htmlSaveOptions);

        for (int i = 0; i < 5; ++i)
        {
            var docReopen = new Document(@".\stylesOut.html");
            docReopen.Save(@".\stylesOut.html", htmlSaveOptions);
        }
        var docResave = new Document(@".\stylesOut.html");
        docResave.Save(@".\stylesFinal.docx");

I’ve attached the test files and a screenshot for your reference. This issue doesn’t happen if I used Word ‘save as html’ feature, could you please help me check this?

styles.zip (14.2 KB)
image.png (37.0 KB)

Thanks,

@ServerSide527

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18057. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.