Row bottom border for a table that is spanned across two pages

Hi Team,
We are currently generating a word document using Aspose (version 9.1). As part of this requirement we create a table and add rows to it dynamically. Now, there are cases where the table is being spanned across muliple pages as per the data. In these cases a the last row shown on the page is not having bottom border. Can you please us in fixing this behavior.

Please fnd attached document that shows our problem(refer pages 5 to 6 & 7 to 8)

Thanks

Hello
Thanks for your request. Please try using more recent version of Aspose.Words for .NET and let me know how it goes on your side.
If it does not help, could you please show me your code and attach the input document you are getting problem with? I will investigate the problem on my side and provide you more information.
You can download the latest version from here:
https://releases.aspose.com/words/net
Best regards,

Hi,
Thank you for the quick reply. At this point of time, we may not be able to buy new license as we have to go through formal approvals from the Customer. On the otherhand, would you mind looking at the document and provide some help on fixing the same at the earliest possible?
For your reference, we have provided the attachment again, which was sent earlier.
Thanks in advance.
Regards,

Hi
Thanks for your inquiry. Could you please attach your input document here for testing? I will check it on my side and provide you more information.
Also, you should note, all fixes and new features are added to new versions of Aspose.Words. So there is no way to get fix of a problem without update to the latest version.
Best regards,

Hi,
Are you not able to view the attachment? can we have your mail id, so that we can send it directly?
Thanks,

Hi
Thanks for your inquiry. I see the attached PDF document, but I need your input DOC/DOCX document (template) or code which you are using to generate such document.
Best regards,

Hi,
As per suggesion, we have used ASPOSE.Word evaluation ver 10.0.0, but still we are facing the same problem while generating PDF document.
Is it possible to send us the sample code with the Property / Method, that you think can be off useful to us, which is used in resolving this issue (table extending to multiple pages with proper table border set in the each page).
Thanks in advance.

Hello
Thanks for your inquiry. Please see the following simple code and the attached documents:

Document doc = new Document("C:\\Temp\\in.doc");
// Create dummy datasource.
DataTable data = new DataTable("MyData");
data.Columns.Add("DataName");
data.Columns.Add("DataValue");
// Add few rows.
for (int i = 0; i <50; i++)
    data.Rows.Add(new object[]
    {
        "Name " + i, "Value " + i
    });
doc.MailMerge.ExecuteWithRegions(data);
doc.Save("C:\\Temp\\out.doc");
doc.Save("C:\\Temp\\out.pdf");

As you can see the output PDF looks as expected.
Could you please create simple application, which will demonstrate the problem on my side? I will check it and provide you more information.
Best regards,

Thank you sending us the code. We are using Table object of ASPOSE.Word using CreateTable, InsertCell & EndRow etc… methods.
We are getting data as Generic List and looping through each of the record to create Table Rows dynamically.
I would appreciate if you could send us the sample using CreateTable object.
- Thanks

Hello
Thank you for additional information. Please see the following simple code and the attached documents:

// Create document and DocumentBuilder
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.Color = Color.Black;
builder.CellFormat.Width = 100;
builder.RowFormat.HeightRule = HeightRule.Exactly;
builder.RowFormat.Height = 30;
// Create heading row that will be repeated on each page
builder.RowFormat.HeadingFormat = true;
builder.Bold = true;
for (int i = 0; i <2; i++)
{
    builder.InsertCell();
    builder.Write(string.Format("Name {0}", i));
}
builder.EndRow();
builder.RowFormat.HeadingFormat = false;
builder.Bold = false;
// Generate body of table
for (int rowIdx = 0; rowIdx <100; rowIdx++)
{
    for (int colIdx = 0; colIdx <2; colIdx++)
    {
        builder.InsertCell();
        builder.Write(string.Format("Value {0} {1}", rowIdx, colIdx));
    }
    builder.EndRow();
}
builder.EndTable();
// Save output document
doc.Save("C:\\Temp\\out.doc");
doc.Save("C:\\Temp\\out.pdf");

Best regards,

Ok, the problem is when you apply some styles to each of the cells. Requirement some of the Cells, we need to show in Grey color and in between show dotted lines etc…if possible put more text in a cell which is falling near the bottom of the page in the samples sent in Page 1 in the last cell where “Value 19 0” is there add some more text to it, so that the text will extend beyond the first page and hightlight the cell with Grey color and see.
- Thnaks

Hello
Thanks for your inquiry. Could you please change my code yourself according to your needs, and send to me. I will check it and provide you more information.
Best regards,

Hi,
We have modified your code as per our requirement and here is the code. Attached also sample report we got after executing it. In the report, at the end of the each page, we need to have a bottom border, when the table is extending to next page and there is a content in the last row’s cell in a page.

// Create document and DocumentBuilder
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.Color = Color.Black;
builder.CellFormat.Width = 100;
builder.RowFormat.HeightRule = HeightRule.Exactly;
builder.RowFormat.Height = 30;

int numberOfCols = 4;
int numberOfRows = 100;
// Create heading row that will be repeated on each page
builder.RowFormat.HeadingFormat = true;
builder.Bold = true;
for (int i = 0; i <numberOfCols; i++)
{
    builder.InsertCell();
    builder.Write(string.Format("Name {0}", i));
}
builder.EndRow();
builder.RowFormat.HeadingFormat = false;
builder.Bold = false;
// Generate body of table
for (int rowIdx = 0; rowIdx <numberOfRows; rowIdx++)
{
    for (int colIdx = 0; colIdx <numberOfCols; colIdx++)
    {
        Cell currentCell = builder.InsertCell();
        currentCell.CellFormat.Borders.Left.LineStyle = LineStyle.Single;
        currentCell.CellFormat.Borders.Right.LineStyle = LineStyle.Single;
        if ((colIdx % 2) == 0 && (rowIdx % 2) == 0)
        {
            currentCell.CellFormat.Borders.Top.LineStyle = LineStyle.Single;
            currentCell.CellFormat.Borders.Bottom.LineStyle = LineStyle.None;
        }
        else
        {
            currentCell.CellFormat.Borders.Top.LineStyle = LineStyle.None;
            currentCell.CellFormat.Borders.Bottom.LineStyle = LineStyle.None;
        }
        if (rowIdx == 19)
        {
            builder.Write(string.Format("The row number is: {0},The column number is:{1}", rowIdx, colIdx));
        }
        else
        {
            builder.Write(string.Format("Value {0} {1}", rowIdx, colIdx));
        }
        if (rowIdx == numberOfRows - 1)
        {
            currentCell.CellFormat.Borders.Bottom.LineStyle = LineStyle.Single;
        }
    }
    builder.EndRow();
}
builder.EndTable();
// Save output document
doc.Save("C:\\Temp\\out.doc");
doc.Save("C:\\Temp\\out.pdf");

Hello
Thank you for additional information. As you may know, MS Word document is flow document and does not contain any information about its layout into lines and pages. Our Rendering Engine layouts documents into lines and pages.
But unfortunately, there is no public API, which allows you to determine where page starts or ends. So there is no way to identify the row the bottom border should be applied to.
Best regards,