Hi team,
I’m currently converting a Word document to HTML. The document contains content controls, but I’ve noticed that some of them are not appearing in the HTML output.
Could you please help me understand why this is happening and how I can resolve it?
Source Document:
ContentControlIssue.docx (35.3 KB)
Content Controls :
Content Control Tag Id :
e15-6a6-16d-865-e23c
a72-361-dcc-8fd-a130
@AlpeshChaudhariDev
Cause
The issue with content controls not appearing in the HTML output when converting a Word document is due to the way Aspose.Words handles certain elements during the conversion process. Some content controls may not be fully supported or may require specific settings to be rendered correctly in HTML.
Solution
To resolve this issue, follow these steps:
-
Update Aspose.Words: Ensure you are using the latest version of Aspose.Words, as updates often include bug fixes and improvements related to document conversion.
-
Check Content Control Types: Verify the types of content controls used in your document. Some types may not be supported for HTML output.
-
Use SaveOptions: When saving the document to HTML, specify the HtmlSaveOptions
to control how content is rendered. For example, set the ExportHeadersFooters
option to true if your content controls are within headers or footers.
-
Inspect Document Structure: Review the structure of your Word document to ensure that the content controls are correctly placed and not nested within unsupported elements.
Code
Here’s a sample code snippet to convert a Word document to HTML with specific save options:
import com.aspose.words.*;
public class ConvertToHtml {
public static void main(String[] args) throws Exception {
Document doc = new Document("ContentControlIssue.docx");
HtmlSaveOptions options = new HtmlSaveOptions();
options.setExportHeadersFooters(true); // Adjust as needed
doc.save("Output.html", options);
}
}
Next Steps
- Test the conversion with the updated code and settings.
- If the issue persists, simplify the document by removing or modifying problematic content controls.
- If you continue to experience issues, please share a sample document for further investigation.
Please let me know if you need any further assistance!
@AlpeshChaudhariDev Could you please check the latest version of Aspose.Words. Here’s my output:
output.zip (2.7 KB)
Thanks for your response. As you can see, my entire table is not wrapped inside the .sdt
div. And I am using Aspose.Word 25.5.0.0
@AlpeshChaudhariDev
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28423
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.