Free Support Forum - aspose.com

Table borders not printing at the top and bottom across more than 1 page

I am currently using the latest version of Aspose.Words. I want to display a border around a table in my word document. I am using the table.SetBorder methods.


This border needs to display at the top and bottom of the table even if the table goes across more than page. The release notes for version 13.1.0 indicate that issue WORDSNET-7431 has been fixed. This issue is titled Table borders are not rendering at the very bottom edge of Page in Pdf.

I can’t seem to get table borders printing at the top and bottom across more than 1 page even when outputting to PDF or word.

Can you please advise whether this issue really has been addressed and how do I implement it?



Hi,


Thanks for your interest in Aspose.Words.

I have generated a couple of documents (please see the attachments) by using the following code snippet; the Table borders are comming out nicely. Could you please attach your 1) input word document, 2) output Word/PDF documents and 3) expected documents here for testing? It would be great if you please also share your piece of source code ie. causing this problem. I will investigate the issue(s) on my side and provide you more information.

Document
doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

// We call this method to start building the table.

Table table = builder.StartTable();

builder.InsertCell();

builder.Write("Row 1, Cell 1 Content.");

// Build the second cell

builder.InsertCell();

builder.Write("Row 1, Cell 2 Content.");

// Call the following method to end the row and start a new row.

builder.EndRow();

// Build the first cell of the second row.

builder.InsertCell();

// Write a few Paragraph to span table across two pages

for (int i = 0; i < 50; i++)

builder.Writeln("Row 2, Cell 1 Content");

// Build the second cell.

builder.InsertCell();

builder.Write("Row 2, Cell 2 Content.");

builder.EndRow();

// Signal that we have finished building the table.

builder.EndTable();

// Set a green border around the table but not inside.

table.SetBorder(BorderType.Left, LineStyle.Single, 1.5, Color.Green, true);

table.SetBorder(BorderType.Right, LineStyle.Single, 1.5, Color.Green, true);

table.SetBorder(BorderType.Top, LineStyle.Single, 1.5, Color.Green, true);

table.SetBorder(BorderType.Bottom, LineStyle.Single, 1.5, Color.Green, true);

builder.Document.Save(@"C:\temp\out.docx");

builder.Document.Save(@"C:\temp\out.pdf");


Moreover, I would suggest you please take a look at the articles mentioned in the following link:
http://www.aspose.com/docs/display/wordsnet/Applying+Formatting+to+Table%2C+Row+and+Cell

I hope, this helps.

Best regards,