sergey-tihon / Clippit

Fresh PowerTools for OpenXml
https://sergey-tihon.github.io/Clippit/
MIT License
50 stars 19 forks source link

First tab in paragraph is ignorred #51

Open evgeny-burmakov opened 2 years ago

evgeny-burmakov commented 2 years ago

First tab in paragraph is ignorred during conversion OpenXml Word file into HTML by WmlToHtmlConverter.ConvertToHtml(). As result layout is corrupted and words are overlaped each other.

OpenXml:

<w:p w14:paraId="1ED11E10" w14:textId="54EA0B67" w:rsidR="008635E7" w:rsidRDefault="008F0094">
      <w:r>
        <w:t>BlaBlaBlaBlaBla</w:t>
      </w:r>
      <w:r>
        <w:tab />
      </w:r>
      <w:r>
        <w:t>Bla</w:t>
      </w:r>
</w:p>

Result HTML:

<div>
      <p dir="ltr" class="pt-Normal">
        <span lang="en-GB" class="pt-DefaultParagraphFont">BlaBlaBlaBlaBla</span>
        <span lang="en-GB" class="pt-DefaultParagraphFont-000000">Bla</span>
      </p>
</div>

FirstTab.docx FirstTab-html

sergey-tihon commented 2 years ago

Can you please try tabWidth attribute on the <w:tab>

https://github.com/sergey-tihon/Clippit/blob/master/OpenXmlPowerTools/WmlToHtmlConverter.cs#L469-L473

https://github.com/sergey-tihon/Clippit/blob/master/OpenXmlPowerTools/WmlToHtmlConverter.cs#L556-L559

evgeny-burmakov commented 2 years ago

I created that file directly in the Word application. But mentioned attribute (PtOpenXml.TabWidth) is custom PowerTool attribute which is created during file conversion (e.g. there https://github.com/sergey-tihon/Clippit/blob/master/OpenXmlPowerTools/WmlToHtmlConverter.cs#L1967-L1970).