简体   繁体   中英

Using word-wrap: break-word in flyingsaucer

The css style "word-wrap: break-word" does not work while I export the html file to PDF by flyingsaucer.

I defined a class in css file

.class-name{
  word-wrap: break-word
}

and below is my html file

<table class="class-name">
<tr>
  <td>
    something very long
    ...
    ...
    ...
  </td>
</tr>
</table>

I followed the solution in number cannot be wrapped in flyingsaucer and itext but it did not work.

The version of my flyingsaucer is >9 and the version of itext is 2.1.7

I also have similar experience. The version of my flying saucer was 9.0.4 and the version of iText was also 2.1.7 .

At first, I was disappointed because I found that "word-wrap" is a CSS 3.0 feature but flying saucer 9.0.4 officially supports up to CSS 2.1 .

However, I find that "word-wrap" still works while I write inline style in HTML file instead of using separate CSS file. You can try the following code to export PDF again.

<table style="word-wrap: break-word">
<tr>
  <td>
    something very long
    ...
    ...
    ...
  </td>
</tr>
</table>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM