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

Free Support Forum - aspose.com

Structured Document Tag not available in html markup on converting Docx to Html Fixed

Hi Team,

I am using Aspose.Words for .NET and trying to convert docx to html using HtmlFixedSaveOptions but in resulting html markup Structured Document Tag is missing. Am I missing anything to export?

sample code is here:

Aspose.Words.Saving.HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
options.Encoding = System.Text.Encoding.UTF8;
options.UseHighQualityRendering = true;
options.AllowEmbeddingPostScriptFonts = true;
options.PrettyFormat = true;
options.SaveFormat = SaveFormat.HtmlFixed;
options.ExportEmbeddedImages = true;
options.ExportEmbeddedFonts = true;
options.ExportEmbeddedCss = true;
options.ExportEmbeddedSvg = true;
options.ExportFormFields = true;
var wordloadoption = new Aspose.Words.Loading.LoadOptions() { LoadFormat = LoadFormat.Docx };

//here Content has some Structured Document Tag
Aspose.Words.Document doc = new Aspose.Words.Document(Content, wordloadoption);

doc.Save(@"D:\abc.html",, options);

@himanshu44 Could you please attach your input document here for testing? we will check the issue and provide you more information.

Upon converting documents to fixed page formats Aspose.Words updated SDT content by default. This might cause the content to be changed in SDT. You can disable this by setting HtmlFixedSaveOptions.UpdateSdtContent to false:

options.UpdateSdtContent = false;

Please try whether this resolves your issue.

Find below attachment of document and screenshot in which SDT’ are highlighted. as you can see there is no attribute, tag or class in html which identify these word’s are surrounded by SDT tag.

18a0718a-34e9-478e-83c2-994321ac95d7.docx (1.1 MB)

@himanshu44 Thank you for additional information. This is an expected behavior. Fixed HTML format is used for exact visual representation of MS Word documents. This format does not support exporting form fields or content controls. Only content of these controls is exported to fixed HTML as a simple text.

Thank you for your information.

Will you please suggest me for my requirement which is best suitable approach to use. I need exact visual representation of MS Word documents and require SDT marking (attributes or class).
By using HtmlSaveOptions SaveFormat.Html will causes formatting issues like images are not properly visible, headers and footers alignment issues, pages not visible properly etc.

Also, I found one similar ticket as follows
In this, team raise WORDSNET-23356 in issue tracking system. Is it solved or not?

I appreciate you for quick response.

@himanshu44 Unfortunately, WORDSNET-23356 is not resolved yet. I have linked your request to this issue. We will keep you informed and let you know once it is resolved.
Unfortunately, I cannot suggest you an elegant way to mark SDT in Fixed HTML. As an option, you can mark SDT with bookmarks, which are exported to Fixed HTML, as I suggested in the thread you have mentioned.

Thank you @alexey.noskov for your support.

1 Like