Problem with <br> in v3
See original GitHub issueWhen I was using v2 with the autoTableHtmlToJson(), I am able to get line break with the <br>
tag.
However after using v3 with the html option, I am not able to get it anymore.
For example, a text like this:
Morbi lectus felis, <br>
accumsan id hendrerit nec, <br>
scelerisque ut tellus.
Will become like this: Morbi lectus felis, accumsan id hendrerit nec, scelerisque ut tellus.
My options are like this:
doc.autoTable({
html:tbl,
theme:'grid',
rowPageBreak: 'avoid',
styles: { overflow: 'linebreak',lineWidth : 1,lineColor : 200 }, //??
columnStyles: {0: {cellWidth: 250},1: {cellWidth: 265}},
});
May I ask is this my own problem or v3 does not allow line break with
anymore?
Thanks a lot!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Is it sometimes bad to use <BR />? - Stack Overflow
The main reason for not using <br> is that it's not semantic. If you want two items in different visual blocks, you probably...
Read more >Problem with <br> Tag in Chrome/Windows - Tumult Forums
The problem is you have a character along with the text within the quotes. The character only shows up on PC but is...
Read more ><br>: The Line Break element - HTML - MDN Web Docs - Mozilla
The HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division...
Read more >The problem with the line break (BR) tag - Davin's blog
Common reasons to use line breaks · Trying to avoid an orphan · Inserting a line break before a 2-word proper noun, like...
Read more >HTML br tag - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
maybe this can help. Add your break like this in your html.
Morbi lectus felis, <br />\n
accumsan id hendrerit nec, <br />\n
adding the simple \n part solved the issue for me 😉
“The Library always looking for
\n
to render the next line / Line break in the table cell.”If you working with angular, Then angular always render with a random attribute within the tag ( eg:
<br _ngcontent-lfs-c183>
) so the library can not identify and split with<br>
and add\n
at the end of each split valueSo parse td cell content with InnerHTML Directive
<td [innerHTML]="parseNextLine(textToRender)"></td>
and create a function that converts
\n
to<br>
parseNextLine(text) { return text.replace(/(\\r\\n)|([\r\n])/gmi, '<br>');}
please note:
<br/>
is not accepted by the library at all use only<br>