itext XMLWorkerHelper ignores value attribute of <li> tag

怎甘沉沦 提交于 2019-12-08 01:55:09

问题


I'm using itext 5.4.5 with XMLWorker 5.4.5 to generate pdf from html that cames from ckEditor. Users can also paste some text from word documents and this results sometimes in something like this:

<ol>
   <li value="3">some text1</li>
</ol>
<div>lorem ipsum dolor</div>
<ol>
   <li value="100">some text2</li>
</ol>
<div>lorem ipsum dolor</div>
<ol>
   <li value="77">some text3</li>
</ol>

this results in ckEditor and in html as

   3. some text1    
lorem ipsum dolor    
   100. some text2    
lorem ipsum dolor
   77. some text3

But if itext convert this html to pdf, it ignores the value of li-tags and sets it to "1." and this results in something like

  1. some text1

lorem ipsum dolor

  1. some text2

lorem ipsum dolor

  1. some text3

Does somebody knows a way, make itext read and also use the numeric value of a li-tag?

Thanks in advance.


回答1:


Use "start" attribute of <ol> tag, like below:

<ol start="3">
  <li>some text1</li>
</ol>
<div>lorem ipsum dolor</div>
<ol start="100">
  <li>some text2</li>
</ol>


来源:https://stackoverflow.com/questions/21696426/itext-xmlworkerhelper-ignores-value-attribute-of-li-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!