Hi- Need help regarding UI of aspose.pdf

I have created a table with following code

Aspose.Pdf.Table tblMainHeader = new Aspose.Pdf.Table();

tblMainHeader.IsFitToPage = true;

tblMainHeader.ColumnWidths = ("550");

Aspose.Pdf.Row rDoc = tblMainHeader.Rows.Add();

rDoc.DefaultCellTextInfo.BackgroundColor = new Aspose.Pdf.Color("Green");

rDoc.DefaultCellTextInfo.Color = new Aspose.Pdf.Color("White");

Aspose.Pdf.Cell clblDocHeader = rDoc.Cells.Add("Documents");

clblDocHeader.DefaultCellTextInfo.FontSize = 12;

Aspose.Pdf.Table tblDocData = new Aspose.Pdf.Table();

tblDocData.IsBroken = false;

tblDocData.IsFitToPage = true;

tblDocData.DefaultCellBorder = new Aspose.Pdf.BorderInfo((int)Aspose.Pdf.BorderSide.All, 0.1F);

tblDocData.ColumnWidths = ("90 250 40 80 90");

DataTable dtDocuments = RiskMaintBL.GetDocumentsPDF(Request["RiskId"]);

Aspose.Pdf.Row rDocHeader = tblDocData.Rows.Add();

rDocHeader.DefaultCellTextInfo.BackgroundColor = new Aspose.Pdf.Color("#99CC00");

rDocHeader.DefaultCellTextInfo.Color = new Aspose.Pdf.Color("White");

Aspose.Pdf.Cell c1header = rDocHeader.Cells.Add("Status");

Aspose.Pdf.Cell c2header = rDocHeader.Cells.Add("Document Name");

Aspose.Pdf.Cell c3header = rDocHeader.Cells.Add("Control Name");

Aspose.Pdf.Cell c4header = rDocHeader.Cells.Add("Added By");

Aspose.Pdf.Cell c5header = rDocHeader.Cells.Add("Added On");

rDocHeader.DefaultCellTextInfo.FontSize = 8;

rDocHeader.DefaultCellTextInfo.IsTrueTypeFontBold = true;

int i;

for (i = 0; i <= dtDocuments.Rows.Count - 1; i++)

{

Aspose.Pdf.Row r11 = tblDocData.Rows.Add();

r11.DefaultCellTextInfo.FontSize = 8;

r11.DefaultRowCellPadding = new MarginInfo();

r11.DefaultRowCellPadding.Left = 2F;

r11.DefaultRowCellPadding.Right = 2F;

r11.DefaultRowCellPadding.Top = 2F;

r11.DefaultRowCellPadding.Bottom = 2F;

int j;

for (j = 0; j <= dtDocuments.Columns.Count - 1; j++)

{

Aspose.Pdf.Cell clbl = r11.Cells.Add((dtDocuments.Rows[i][j]).ToString());

}

}

sec1.Paragraphs.Add(tblMainHeader);

sec1.Paragraphs.Add(tblDocData);

If you notice PDF output, the third column header text is wrapped, and color is also coming in both rows, but for others, the background color is not coming in both rows.

Also, we can see a small white line between the border line and the color of table header text. How can that be fixed?

Hi,

It seems, your problem is related to Aspose.Pdf and not Aspose.Cells.

So, I am moving your thread to appropriate forum. Aspose.Pdf support team will help you asap.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

I am able to reproduce your mentioned issue regarding wrapping after an initial test using the latest version of Aspose.Pdf for .NET v6.5. The issue has been registered in our issue tracking system with issue id: PDFNEWNET-33104 for rectification. However, I think you can resolve this issue by managing the column widths of the columns and avoiding the text wrapping. Also, I am unable to reproduce your other issue regarding “Small White Line” with the latest version of Aspose.Pdf for .NET. As you are using an older version of Aspose.Pdf for .NET, I would suggest you to download and try the latest version and if you still face any issue, please share your generated PDF file with us to show the issue.

Sorry for the inconvenience,

Thanks Aslam.

I cannot change the column width, as there are many other columns in the table. This column will look huge and others squeezed. It shall be really helpful if you can provide me a fix for this.

Thanks.

Hi,


Thanks for your patience.

I am pleased to share that the issue reported earlier has been resolved. Please try using classes present under Aspose.Pdf namespace. The hotfix will be included in upcoming release version of Aspose.Pdf for .NET 8.0.0 which is planned to release in current week.

[C#]

Document doc = new
Document();<o:p></o:p>

Page page = doc.Pages.Add();

// Create a table...

Aspose.Pdf.Table tblMainHeader = new Aspose.Pdf.Table();

//tblMainHeader.IsFitToPage = true;

tblMainHeader.ColumnWidths = ("450.9");

Aspose.Pdf.Row rDoc = tblMainHeader.Rows.Add();

rDoc.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Green);

rDoc.DefaultCellTextState = new TextState();

rDoc.DefaultCellTextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.White);

Aspose.Pdf.Cell clblDocHeader = rDoc.Cells.Add("Documents");

clblDocHeader.DefaultCellTextState = new TextState();

clblDocHeader.DefaultCellTextState.FontSize = 12;

Aspose.Pdf.Table tblDocData = new Aspose.Pdf.Table();

tblDocData.IsBroken = false;

//tblDocData.IsFitToPage = true;

tblDocData.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);

tblDocData.ColumnWidths = ("90 150 40 80 90");

DataTable dtDocuments = new DataTable();

dtDocuments.Columns.Add("1", Type.GetType("System.String"));

dtDocuments.Columns.Add("2", Type.GetType("System.String"));

dtDocuments.Columns.Add("3", Type.GetType("System.String"));

dtDocuments.Columns.Add("4", Type.GetType("System.String"));

dtDocuments.Columns.Add("5", Type.GetType("System.String"));

for (int row = 0; row <= 10; row++)

{

DataRow dr = dtDocuments.NewRow();

dr[0] = "Status " + row.ToString();

dr[1] = "Document " + row.ToString();

dr[2] = "Control " + row.ToString();

dr[3] = "Added By " + row.ToString();

dr[4] = "Added On " + row.ToString();

dtDocuments.Rows.Add(dr);

}

dtDocuments.AcceptChanges();

Aspose.Pdf.Row rDocHeader = tblDocData.Rows.Add();

rDocHeader.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(0x99, 0xCC, 0));

Aspose.Pdf.Cell c1header = rDocHeader.Cells.Add("Status");

Aspose.Pdf.Cell c2header = rDocHeader.Cells.Add("Document Name");

Aspose.Pdf.Cell c3header = rDocHeader.Cells.Add("Control Name");

c3header.IsWordWrapped = false;

Aspose.Pdf.Cell c4header = rDocHeader.Cells.Add("Added By");

Aspose.Pdf.Cell c5header = rDocHeader.Cells.Add("Added On");

rDocHeader.DefaultCellTextState = new TextState();

rDocHeader.DefaultCellTextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.White);

rDocHeader.DefaultCellTextState.FontSize = 8;

rDocHeader.DefaultCellTextState.FontStyle = FontStyles.Bold;

int i;

for (i = 0; i <= dtDocuments.Rows.Count - 1; i++)

{

Aspose.Pdf.Row r11 = tblDocData.Rows.Add();

r11.DefaultCellTextState = new TextState();

r11.DefaultCellTextState.FontSize = 8;

r11.DefaultCellPadding = new Aspose.Pdf.MarginInfo();

r11.DefaultCellPadding.Left = 2F;

r11.DefaultCellPadding.Right = 2F;

r11.DefaultCellPadding.Top = 2F;

r11.DefaultCellPadding.Bottom = 2F;

int j;

for (j = 0; j <= dtDocuments.Columns.Count - 1; j++)

{

Aspose.Pdf.Cell clbl = r11.Cells.Add((dtDocuments.Rows[i][j]).ToString());

}

}

page.Paragraphs.Add(tblMainHeader);

page.Paragraphs.Add(tblDocData);

doc.Save(“c:/pdftest/TextWrappingIssue.pdf”);

The issues you have found earlier (filed as PDFNEWNET-33104) have been fixed in Aspose.Pdf for .NET 8.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.