I used some code in DocxToXhtmlAndBack code sample but it seems the format is lost for bullets and lists, below is the xhtml I got:
- 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;}
.Normal {display:block;}
.ListParagraph {display:block;position: relative; margin-left: 0.5in;}
/* CHARACTER STYLES */ span.DefaultParagraphFont {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">
<p class="Normal DocDefaults " style="position: relative; margin-left: 0.51in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">Indentation text</span></p>
<p class="Normal DocDefaults " style="position: relative; margin-left: 17mm;"> </p>
<p class="ListParagraph Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #010101;font-size: 8.0pt;">Bullet1</span></p>
<p class="ListParagraph Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #010101;font-size: 8.0pt;">Bullet2</span></p>
<p class="ListParagraph Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #010101;font-size: 8.0pt;">Bullet3</span></p>
<p class="ListParagraph Normal DocDefaults "><span class="" style="">Sub bullet1</span></p>
<p class="ListParagraph Normal DocDefaults "><span class="" style="">Sub bullet2</span></p>
<p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1.5in;"> </p>
<p class="ListParagraph Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #010101;font-size: 8.0pt;">num1</span></p>
<p class="ListParagraph Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #010101;font-size: 8.0pt;">num2</span></p>
<p class="ListParagraph Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #010101;font-size: 8.0pt;">num3</span></p>
<p class="ListParagraph Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #010101;font-size: 8.0pt;">num4</span></p></div>
<!-- userBodyTail goes here -->
</body></html>
The only preserved format is indentation. Is there any way to keep the bullets and lists format during the conversion? And not using any css but pure html? I want to display the converted file in an online editor that handles html. Thanks.