Free Support Forum - aspose.com

Data does not show up in table

In version 1.8.6.0 data does not show up in table at font size 8 but when I change the font size to 7 the data appears. I switched to a smaller font size to verify that data is actually going into the table. This was working fine in earlier versions.

David

Dear David,

Thank you for considering Aspose.

Can you please send me an example that can reproduce this error?

private void AddFoodSectionRow(Aspose.Pdf.Section oSection, Aspose.Pdf.Table oTable, string sString)

{

Row oRow = new Row(oTable);

oRow.Padding = new MarginInfo();

oRow.Padding.Left = 0;

oRow.Padding.Top = 1;

oRow.Padding.Bottom = 1;

BorderInfo border = new BorderInfo();

GraphInfo oGraphInfo = new GraphInfo();

oGraphInfo.LineWidth = 0.1f;

border.Top = oGraphInfo;

border.Bottom = oGraphInfo;

oRow.Border = border;

Cell oCell = new Cell(oRow);

oCell.Padding = new MarginInfo();

oCell.Padding.Right = 2;

oCell.Padding.Left = 2;

oCell.Padding.Top = 1;

oCell.Padding.Bottom = 1;

oCell.ColumnsSpan = 2;

Text oText = new Text(oSection);

oCell.Paragraphs.Add(oText);

Segment oSegment = new Segment(oText);

oText.Segments.Add(oSegment);

oSegment.Content = sString;

oSegment.TextInfo.FontName = “Helvetica-Bold”;

oSegment.TextInfo.FontSize = 10;

oRow.Cells.Add(oCell);

oCell = new Cell(oRow);

oCell.Padding = new MarginInfo();

oCell.Padding.Right = 2;

oCell.Padding.Left = 2;

oCell.ColumnsSpan = 2;

oText = new Text(oSection);

oText.TextInfo.Alignment = AlignmentType.Center;

oCell.Paragraphs.Add(oText);

oSegment = new Segment(oText);

oText.Segments.Add(oSegment);

oSegment.Content = “Frequency”;

oSegment.TextInfo.FontName = “Helvetica-Bold”;

oSegment.TextInfo.FontSize = 8;

oRow.Cells.Add(oCell);

AddCell(oSection, oRow, 10, 8, “”, false);

oCell = new Cell(oRow);

oCell.Padding = new MarginInfo();

oCell.Padding.Right = 2;

oCell.Padding.Top = 1;

oCell.Padding.Bottom = 1;

oCell.Padding.Left = 2;

oCell.ColumnsSpan = 4;

oText = new Text(oSection);

oText.TextInfo.Alignment = AlignmentType.Center;

oCell.Paragraphs.Add(oText);

oSegment = new Segment(oText);

oText.Segments.Add(oSegment);

oSegment.Content = “Daily Amounts”;

oSegment.TextInfo.FontName = “Helvetica-Bold”;

oSegment.TextInfo.FontSize = 8;

oRow.Cells.Add(oCell);

oTable.Rows.Add(oRow);

}

private void AddFoodRow(Aspose.Pdf.Section oSection, Aspose.Pdf.Table oTable, string string1, string string2, string string3, string string4, string string5, string string6, string string7, string string8, bool isHeader)

{

Row oRow = new Row(oTable);

oRow.Padding = new MarginInfo();

oRow.Padding.Left = 0;

oRow.Padding.Top = 1;

oRow.Padding.Bottom = 1;

if (isHeader)

{

//BorderInfo border = new BorderInfo();

//GraphInfo oGraphInfo = new GraphInfo();

//oGraphInfo.LineWidth = 0.1f;

//border.Top = oGraphInfo;

//border.Bottom = oGraphInfo;

//oRow.Border = border;

}

AddCell(oSection, oRow, 150, 8, string1, isHeader);

AddCell(oSection, oRow, 150, 8, string2, isHeader);

AddCell(oSection, oRow, 45, 8, string3, isHeader);

AddCell(oSection, oRow, 40, 8, string4, isHeader);

AddCell(oSection, oRow, 10, 8, “”, isHeader);

AddCell(oSection, oRow, 32, 8, string5, isHeader);

AddCell(oSection, oRow, 32, 8, string6, isHeader);

AddCell(oSection, oRow, 32, 8, string7, isHeader);

AddCell(oSection, oRow, 32, 8, string8, isHeader);

//AddCell(oSection, oRow, 45, 8, string9, isHeader);

oTable.Rows.Add(oRow);

}

private void AddCell(Aspose.Pdf.Section oSection, Row oRow, float fWidth, float fFontSize, string sString, bool isHeader)

{

Cell oCell = new Cell(oRow);

oCell.FitWidth = fWidth;

oCell.Padding = new MarginInfo();

oCell.Padding.Right = 2f;

oCell.Padding.Left = 2f;

oCell.Padding.Top = 1f;

oCell.Padding.Bottom = 1f;

Text oText = new Text(oSection);

oCell.Paragraphs.Add(oText);

Segment oSegment = new Segment(oText);

oText.Segments.Add(oSegment);

oSegment.Content = sString;

oSegment.TextInfo.FontName = isHeader?“Helvetica-Bold”:“Helvetica”;

oSegment.TextInfo.FontSize = fFontSize;

oRow.Cells.Add(oCell);

}

Dear David,

Thank you for considering Aspose.

I have used the following code to test you functions and have not found the error:

Pdf pdf = new Pdf();

Section sec1 = pdf.Sections.Add();
sec1.PageInfo.PageWidth = 1000;

Table tab1 = new Table();
sec1.Paragraphs.Add(tab1);

AddFoodSectionRow(sec1,tab1,"test1");
AddFoodRow(sec1,tab1,"s1","s2","s3","s4","s5","s6","s7","s8",false);

pdf.Save("e:/temp/test.pdf");

Can you please post the code you used to call these functions that can reproduce the error?

The problem also goes away when I change

from

oTable.IsBroken = false;
oTable.IsRowBroken = false;

to

oTable.IsBroken = true;
oTable.IsRowBroken = true;

The report is multiple pages and does not happen on the first page.

David

It's impossible to send you code and a good example. The report is several pages long and the missing data is not on page one. It also only seems to be missing in the first column near the top but not in the first row. Some of the missing data is wrapped text. In other words the first part is there but the wrapped part underneath is missing.

Hope this helps...

David

Check “oText.TextWidth”. This seems to be new from the previous version (1.5.28) I was using that did not have the problem.

David

Dear David,

Thank you for considering Aspose.

Text.TextWidth is only used for custom positioning.

I’m not able to reproduce this error. If you can’t send an example, can you please send a resulting PDF document that has this error?

Dear David,

Thank you for considering Aspose.

I have fixed this bug. Please download hot fix here.