Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTMLWorker parseToList can not parse table with different tr html String #1094

Open
macbookpro2016 opened this issue Mar 7, 2024 · 7 comments
Labels

Comments

@macbookpro2016
Copy link

macbookpro2016 commented Mar 7, 2024

Describe the bug

if html String have a table with different rows.cells.size,will miss all row

To Reproduce

at IncCell.class,

line 104,
PdfPTable table = new PdfPTable(ncol);
ncol is cell number of first table row
if i have a row is not such many cells, this row will be miss

  1. Sample Code
  2. Unit-Test

Expected behavior

Not given.

System

Not given

@macbookpro2016
Copy link
Author

at IncTable.class , my fault

@asturio
Copy link
Member

asturio commented Mar 8, 2024

Normaly in a table, in a row, when you have less cells, than the table expects, you need to declare which cell has a larger colSpan. OpenPDF won't fill missing cells for you.

@asturio
Copy link
Member

asturio commented Mar 8, 2024

If you have some sample code, that could help finding your problem.

@macbookpro2016
Copy link
Author

Normaly in a table, in a row, when you have less cells, than the table expects, you need to declare which cell has a larger colSpan. OpenPDF won't fill missing cells for you.

how should i do to declare which cell has a small colSpan,thanks

@macbookpro2016
Copy link
Author

Take a look here: https://github.com/LibrePDF/OpenPDF/blob/master/pdf-toolbox/src/test/java/com/lowagie/examples/objects/tables/DefaultCell.java

Thanks for your reply,in my project,i use method HTMLWorker.parseToList() to parse html String automatically, in this method, it is use first table column number to parse table,is there any method to replace this method or any other ways to make i can parse table with rows(with different column), Or how to use DefaultCell in this method ,thanks again!

@asturio
Copy link
Member

asturio commented Mar 16, 2024

Take a look at this example, maybe it can help you.

Example

I'm not sure OpenPDF can do exactly what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants