Clippit icon indicating copy to clipboard operation
Clippit copied to clipboard

First tab in paragraph is ignorred

Open evgeny-burmakov opened this issue 2 years ago • 2 comments

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

evgeny-burmakov avatar Mar 21 '22 09:03 evgeny-burmakov

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

sergey-tihon avatar Mar 27 '22 07:03 sergey-tihon

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).

evgeny-burmakov avatar Mar 30 '22 09:03 evgeny-burmakov