how can I add cellspacing to pdftable when parsing html using XMLWorker and itext

后端 未结 1 1373
半阙折子戏
半阙折子戏 2021-01-26 05:12

I am using XMLWorker and itext to convert html to pdf . my html have a table and I need to set it\'s cellspacing =0 cellpadding=0 . does anyone know how to do it ?

in

1条回答
  •  無奈伤痛
    2021-01-26 06:01

    I've tried what you're doing using the CSS you propose and it works for me:

    enter image description here

    You can find my test here: ParseHtmlTable5

    This is my HTML (including the CSS): table3_css.html

    
    
    
    
    
    
    Firstname Lastname Savings
    Peter Griffin $100
    Lois Griffin $150
    Joe Swanson $300
    Cleveland Brown $250

    I suggest that you compare your HTML with mine to find out what you're doing wrong. You should also use the latest version of XML Worker and iText(Sharp) as we've improved HTML parsing significantly in the latest releases.

    Note that I've defined a solid, green border of 1px to prove that there is no padding and no spacing between the cells. If you change the CSS like this:

    
    

    You'll get the (ugly) version of a table without borders, without spacing between the cells and without padding inside the cells.

    0 讨论(0)
提交回复
热议问题