privateOmega / html-to-docx

HTML to DOCX converter
MIT License
373 stars 140 forks source link

support for line breaks like <br> tag #217

Open satyajitnayk opened 11 months ago

satyajitnayk commented 11 months ago
satyajitnayk commented 11 months ago

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 \some bold\ \
    \
    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.
lycpan233 commented 10 months ago

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