How to process docx to replace bold tags
Posted: Mon Aug 29, 2016 2:33 pm
I am converting docx to html and currently bold texts are not converted correctly.
The following is in the document.xml before conversion
Apparently the following works :
My question is, how do i process the docx to find all <w:b w:val="on"/> and replace it with <w:b/> ?
The following is in the document.xml before conversion
- Code: Select all
<w:tr>
<w:trPr/>
<w:tc>
<w:tcPr>
<w:tcW w:w="9016" w:type="dxa"/>
<w:gridSpan w:val="4"/>
</w:tcPr>
<w:p>
<w:pPr>
<w:ind w:left="0" w:firstLine="0" w:right="95"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:szCs w:val="24"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b w:val="on"/>
<w:bCs w:val="on"/>
<w:szCs w:val="24"/>
<w:lang w:val="en-SG" w:eastAsia="en-GB"/>
</w:rPr>
<w:t xml:space="preserve">BOLD TEXT</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
Apparently the following works :
- Code: Select all
<w:tr>
<w:trPr/>
<w:tc>
<w:tcPr>
<w:tcW w:w="9016" w:type="dxa"/>
<w:gridSpan w:val="4"/>
</w:tcPr>
<w:p>
<w:pPr>
<w:ind w:left="0" w:firstLine="0" w:right="95"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:szCs w:val="24"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
<w:bCs/>
<w:szCs w:val="24"/>
<w:lang w:val="en-SG" w:eastAsia="en-GB"/>
</w:rPr>
<w:t xml:space="preserve">BOLD TEXT</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
My question is, how do i process the docx to find all <w:b w:val="on"/> and replace it with <w:b/> ?