I have simple docx file with numbering list.
I try to convert it to HTML by docx4j 3.2.2 with this solution:
- Code: Select all
SdtWriter.registerTagHandler("HTML_ELEMENT", new SdtToListSdtTagHandler());
HTMLSettings htmlSettings = Docx4J.createHTMLSettings();
htmlSettings.setWmlPackage(wordMLPackage);
Docx4J.toHTML(htmlSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);
But in the resulting HTML file the "display:block" style is set and as the result, digits are not displayed:
- Code: Select all
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><style><!--/*paged media */ div.header {display: none }div.footer {display: none } /*@media print { */@page { size: A4; margin: 10%; @top-center {content: element(header) } @bottom-center {content: element(footer) } }/*element styles*/ .del {text-decoration:line-through;color:red;} .ins {text-decoration:none;background:#c0ffc0;padding:1px;}
/* TABLE STYLES */
/* PARAGRAPH STYLES */
.DocDefaults {display:block;margin-bottom: 4mm;line-height: 115%;font-size: 11.0pt;}
.a {display:block;}
.a3 {display:block;position: relative; margin-left: 0.5in;}
/* CHARACTER STYLES */ span.a0 {display:inline;}
--></style><script type="text/javascript"><!--function toggleDiv(divid){if(document.getElementById(divid).style.display == 'none'){document.getElementById(divid).style.display = 'block';}else{document.getElementById(divid).style.display = 'none';}}
--></script></head><body>
<!-- userBodyTop goes here -->
<div class="document"><ol>
<li class="a3 a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;"><span class="a0 " style="font-size: 14.0pt;;font-family: 'Times New Roman';">One</span><span class="a0 " style="font-size: 14.0pt;;font-family: 'Times New Roman';">2</span></li>
<li class="a3 a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;"><span class="a0 " style="font-size: 14.0pt;;font-family: 'Times New Roman';">Two</span></li>
<li class="a3 a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;"><span class="a0 " style="font-size: 14.0pt;;font-family: 'Times New Roman';">Three</span><span class="a0 " style="font-size: 14.0pt;;font-family: 'Times New Roman';white-space:pre-wrap;"> </span></li></ol></div>
<!-- userBodyTail goes here -->
</body></html>
It looks like:
One2
Two
Three
How can I fix this problem? Thank you