Issue of Word Conversion to PDF related to unchecked (false) feature of Row Break Across Pages- so row of table is breaking across pages in PDF

Hello Aspose Team,
I need to disable break of row of table across pages.
So, I have used below code to uncheck (false) below Option of Row for Table Properties.
Word Option
Table Properties àRow à Option à (Unchecked) Allow row to break across pages.
Java Code

Document doc = new Document("input/SipReport.docx");
@SuppressWarnings("unchecked")
NodeCollection<Table> tables = doc.getChildNodes(NodeType.TABLE, true);
for (Table table : tables)
{
    RowCollection rows = table.getRows();
    for (int i = 0; i < rows.getCount(); i++)
    {
        Row row = rows.get(i);
        RowFormat rowFormat = row.getRowFormat();
        rowFormat.setAllowBreakAcrossPages(false);
        rowFormat.setHeadingFormat(true);
    }
}
doc.save("input/SipReportModified.docx");
Document newDoc = new Document("input/SipReportModified.docx");
newDoc.save("input/SipReport.pdf");

Above code for required option is working for DOCX.
But above code for required option is not working for PDF.
PDF is having issue related to unchecked (false) feature of Row Break Across Pages, hence row of table is breaking across pages in PDF.
Please guide.

Thanks and Regards.

Hello Aspose Team,
1.
I need to disable break of row of
table across pages.
So, I have used below code to uncheck (false) below Option of Row for Table Properties.
Word Option
Table Properties àRow à Option à (Unchecked) Allow row to break across pages.
Java Code

Document doc = new Document("input/SipReport.docx");
@SuppressWarnings("unchecked")
NodeCollection<Table> tables = doc.getChildNodes(NodeType.TABLE, true);
for (Table table : tables)
{
    RowCollection rows = table.getRows();
    for (int i = 0; i < rows.getCount(); i++)
    {
        Row row = rows.get(i);
        RowFormat rowFormat = row.getRowFormat();
        rowFormat.setAllowBreakAcrossPages(false);
        rowFormat.setHeadingFormat(true);
    }
}
doc.save("input/SipReportModified.docx");
Document newDoc = new Document("input/SipReportModified.docx");
newDoc.save("input/SipReport.pdf");

Above code for required option is working for DOCX.
But above code for required option is not working for PDF.
PDF
is having issue related to unchecked (false) feature of Row Break Across Pages,
hence row of table is breaking across pages in PDF.
Please guide.

Thanks and Regards.

Hi Neeraj,

Thanks for your inquiry. In your case, you need to call Document.UpdatePageLayout method before saving document to Pdf.

This method formats a document into pages and updates the page number related fields in the document such as PAGE, PAGES, PAGEREF and REF. The up-to-date page layout information is required for a correct rendering of the document to fixed-page formats.

This method is automatically invoked when you first convert a document to PDF, XPS, image or print it. However, if you modify the document after rendering and then attempt to render it again - Aspose.Words will not update the page layout automatically. In this case you should call UpdatePageLayout before rendering again.

Hello Tahir,

Thank you for your response. Neeraj is my team member. Currently, I am looking for this issue.
As per your instructions, I have modified my code and executed, but I found same result.
I think, this issue is not related to Page Layout. I am not getting any error related to Page Field. It is related to Table and it’s properties in document.

Here, I am modifying Table Property of document but then saving it in New Document. Later I am saving that New Document to PDF. Hence, I am not modifying the same document after rendering.

Please guide.
My modified code is as given below :

Document doc = new Document("Forum/Report.docx");
@SuppressWarnings("unchecked")
NodeCollection tables = doc.getChildNodes(NodeType.TABLE, true);
for (Table table : tables)
{
    RowCollection rows = table.getRows();
    for (int i = 0; i < rows.getCount(); i++)
    {
        Row row = rows.get(i);
        RowFormat rowFormat = row.getRowFormat();
        rowFormat.setAllowBreakAcrossPages(false);
        rowFormat.setHeadingFormat(true);
    }
}
doc.save("Forum/ReportModified.docx");
Document newDoc = new Document("Forum/ReportModified.docx");
newDoc.updatePageLayout(); //expected change in code 
newDoc.save("Forum/Report.pdf");

Thanks and Regards.

Hi Manjurelahi,

Thanks for your inquiry. Could you please attach your input and expected output documents here for testing? We will investigate the issue on our side and provide you more information.

Hello Tahir,

Thank you for your reply.
Meanwhile, I found that this problem is only specific to PDF while converting from DOCX.
Even if row of table is not breaking across pages in DOCX then also PDF conversion is having issue related to break of row of table across pages.

Please find attached files as mentioned below:
1. SampleReport.docx
Input file to be converted in PDF without any change in Table format.

2. SampleReport.pdf
Output file having issue related to break of row of table across pages.

3. ExpectedSampleReport.pdf
Expected Output PDF file

Java Code

public class SampleReport
{
    public static void main(String args[]) throws Exception
    {
        AsposeLicense.setAsposeLicense();
        Document doc = new Document("Forum/SampleReport.docx");
        doc.save("Forum/SampleReport.pdf");
    }
}

Please refer above simple code.
Please guide me to get Expected Output PDF Report.

Thanks and Regards.

Hi Manjurelahi,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14241. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hello Team,

Please update me about status of this issue.
My assigned task is pending because of this issue only.
Please help and guide me to solve this issue.
Waiting for your reply …

Thanks and Regards.

Hi Manjurelahi,

Thanks for your inquiry. We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. Our developers work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, your issue is under analysis. Once our product team completes the analysis of this issue, we will then be able to provide you an estimate.

Thanks for your patience and understanding.

The issues you have found earlier (filed as WORDSNET-14241) have been fixed in this Aspose.Words for .NET 17.3.0 update and this Aspose.Words for Java 17.3.0 update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.