html-to-docx icon indicating copy to clipboard operation
html-to-docx copied to clipboard

support for line breaks like <br> tag

Open satyajitnayk opened this issue 2 years ago • 2 comments

  • The equivalent of force line break using <br> is <w:br/> in DOCX XML openofficexml.

  • Linebreak for paragraph is working fine.

satyajitnayk avatar Sep 28 '23 05:09 satyajitnayk

As of now the library converts <br> to

<w:pPr>
  <w:spacing w:lineRule="auto" />
</w:pPr>
<w:r>
  <w:rPr />
</w:r>

  1. which is correct for line breaking a paragraph ,but doesn't seems right for force line break.
  2. For example: converting "hello I am sam <b>some bold</b> <br><br> some other texts" to DOCX XML is not working , as linebreak under same text run , rather than different paragraphs/text runs.
  3. Instead <w:br/> is correct conversion as per documentation of openofficexml.

satyajitnayk avatar Sep 28 '23 06:09 satyajitnayk

After conversion to docx, in < br/> It will be followed by a blank line

lycpan233 avatar Oct 31 '23 03:10 lycpan233