We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Doesn't write complete Text when setColspan(2) is set

Hello

I have a problem with a Table. The Text is not completly written in cell when I use the colspan of 2.
see code snipped below.
I use Aspose PDF for Java Version 18.12 and I tested it with 19.1. Both have the same problem.

Please help.

String veryLong = "0x7A8202000E20CB8A31B59CA4AF727FDED8085DD829160E6712DAB6CCE2B740DA85CF279E4609D27CF4B0C7E97882B0E005864CF90E4FD6253E08E8FEE818312943F74C59C200448D124577495F47410CDE3B87657485EC79909A1200637ECEB231C3957BE31DD656DA78CA09F1BAD932F036AAFC5BCF429DD60101F3F87BAA7C293CA80300000000000000007C820201C134D5CCAC4C79C3D728F495B584159B6954AAFAF9EE83A6C627AC0442BF5D9CDE699A1D72A04AABE540E5A20E428B3B0E20CB8A31B59CA4AF727FDED8085DD884B68A9AF89A15C06E0AF68F7193D3758C90DEC37AF978DC5CC5EB212A9DEE45E92BD6238635FFE05CB9796FA77814CC551D7D652F8B15F04F623527483A5B3D0000000000000000768202020E20CB8A31B59CA4AF727FDED8085DD8A551A6EB164B4FE52A91B59D319503A58697BE22F430D0F81F35EDD7E04B66760E20CB8A31B59CA4AF727FDED8085DD8F0B838D83E0995077F52E1BBA2F33CA6F41F6B7F3137E163AC5F6CD0139B29D0DB7A340A73ED1D96FD49BE96050DE3AE40B28368CDC62596D039F0A730DBFD6D000000000000000075820203350A30320041EB793C19E33328E189C413A5A3B47647FE94319E2A3FF843745C0900F353A51B9D8F15486C24C506D1B7F5932385984FD893046062AC31425C91D5A00DC40C142C318DE827588C0CA9CF51ACBAA20B6A8E02781D9AA361A0E1B534D789A3536F319CCBB6BFBEEFA7C990F505747F8F9EE9246BA923533B2DB2EC000000000000000073820204F17CC63723BBECF8DD69BE8B063A377188E473EC09D9A6049ECC990E29127423D8A8DA8987FF1085A7620D1DA60B5751E8A2AACA084ABE53D21DD5AD1E6F20480E20CB8A31B59CA4AF727FDED8085DD83EE1DA8DDDCE6D8B28BDE5E7DADA385E451D96838BF07F8003D40DD8816B0CE70B7E2D1465F25D1BF0F36655DAC418DE00000000000000002882020516B14F29090D168DD2416682CD702CF76FE6F19CE5BF6F1D5001F32A665CBBB50690FC0529F55E91D5E1060BD4E5D2A900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
Table table = new Table();
table.getMargin().setLeft(25.5);
table.getMargin().setRight(25.5);
table.setColumnWidths("236 236");
table.setDefaultCellBorder(new BorderInfo(BorderSide.All, 0.2f));
table.setBorder(new BorderInfo(BorderSide.All, borderWidth));
table.setDefaultCellPadding(new MarginInfo(2f, 1f, 5f, 3f));
table.getDefaultCellTextState().setFontSize(12.0f);
table.getDefaultCellTextState().setHorizontalAlignment(HorizontalAlignment.Left);

Row row = table.getRows().add();
addCell(row,"Column 1",1);
addCell(row,"Column 2",1);
row = table.getRows().add();
addCell(row,veryLong,2);
row = table.getRows().add();
addCell(row,"Column 1",1);
addCell(row,"Column 2",1);

pdfPage.getParagraphs().add(table);


private void addCell(Row row, String text, int colspan){
    TextFragment cellContent = createTextFragment();
    cellContent.setText(text);
    Cell cell = row.getCells().add();
    cell.setColSpan(colspan);
    cell.getParagraphs().add(cellContent);
}

private TextFragment createTextFragment(){
    TextFragment cellContent = new TextFragment();
    textFragment.getTextState().setUnderline(false);
    textFragment.getTextState().setFontSize(9.0f);
    textFragment.getTextState().setFontStyle(FontStyles.Regular);
    textFragment.getTextState().setLineSpacing(0.5f);
    textFragment.getTextState().setFont(font);
    textFragment.setHorizontalAlignment(HorizontalAlignment.Left);
    return textFragment;
}
1 Like

@kmuenzer

Thank you for contacting support.

We have attached generated PDF document for your kind reference. Would you please elaborate your concerns with the help of screenshots so that we may investigate further to help you out. colspan_19.1.pdf

The String ‘veryLong’ ends with ‘0’ char 176 times. In the pdf are only 92 written. So we miss 84 times the char ‘0’ at the end.
We tried:

  • to change these last not written chars -> error still exists
  • write the string in only the first or second column (without colspan) -> everything is written

Here are the wanted Screenshot:
2019-02-04 10_23_36-pdf.png (60.0 KB)

Thanks for your help.

@kmuenzer

Thank you for elaborating it further.

We have logged a ticket with ID PDFNET-45988 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-45988) have been fixed in Aspose.PDF for .NET 19.11.