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

Free Support Forum - aspose.com

Duplicate span for Date type content control when converting docx to html

Hi, We are running into an issue with the newer Aspose.Word versions where if we have a Structured Document Tag , content control of type date in docx and converted to html, the see duplicate span tags:

<span style="-aw-sdt-tag:'fldSimpleFieldsForm.OrderDate'; -aw-sdt-title:'Order Date (Simple Fields Form)'" class="fields" title="Order Date (Simple Fields Form)" id="l8k8cdgod2k167cop66v" data-order="1"><span class="PlaceholderText">01/01/1800</span><span>01/01/1800</span></span>

Since there are two spans, the date is seen as duplicate in HTML.

Attached document for referenceAsposeXMLChecks (1).docx (21.0 KB)

Is there a way around this or possibly a newer approach that we need to take for rendering the date correctly in HTML ?

Thank you for any inputs!

@kml2020 Unfortunatly, I cannot reproduce the problem using the latest 22.12 version of Aspose.Words for Java. Here is how date SDT looks in HTML produced on my side:

<span style="-aw-sdt-tag:'fldSimpleFieldsForm.OrderDate'; -aw-sdt-title:'Order Date (Simple Fields Form)'"><span>01/01/1800</span></span>

Here is code used for testing:

Document doc = new Document("C:\\Temp\\in.docx");
HtmlSaveOptions opt = new HtmlSaveOptions();
opt.setPrettyFormat(true);
doc.save("C:\\Temp\\out.html", opt);

Could you please share a simple code that will allow us to reproduce the problem and attach your output HTML file? We will check the code and the file and provide you more informaiton.