Description : When exporting an Excel file to PDF we only want to split the output based on the manually added page breaks and not on the automatically generated Excel (dotted line page breaks). In Excel we have the functionality to drag the page break and align it with our manual page break (which we are setting programmatically). Can you please advise if there is any API to support this request ? If not, please provide us an API to remove the Excel generated page breaks or a workaround to achieve the desired output. Attaching all necessary files/ sample driver code for reference.
NOTE : We cannot hardcode scale/zoom factor as we support a large number of documents and this factor would vary case to case. However, if there is any way to calculate the scale factor programmatically using Aspose APIs, we will be happy to consider that option.
DRIVER CODE:
Workbook wb = new Workbook(“Path/to/file/TestPageBreakIssue.xls”);
Worksheet ws = wb.getWorksheets().get(“Test”);
System.out.println(ws.getHorizontalPageBreaks().getCount()); //This prints 1
System.out.println(ws.getVerticalPageBreaks().getCount()); //This prints 0
wb.save(“Path/to/file/TestPageBreakIssue.pdf”, new PdfSaveOptions()); TestPageBreaksIssue.zip (242.3 KB)
You may add your desired page breaks and remove your unwanted page breaks via the APIs for your requirements. See the document on how to add and remove page breaks with examples for your complete reference.
Moreover, when I checked your expected Excel file, I spotted you did set/adjust scaling to “22%” of the normal size. If you need to do it via the APIs, see the document on how to set page scaling for your reference.
Hi,
We don’t want to hardcode this to 22% because this will be dynamic and different for each case. Just want to know how we can remove the excel page breaks via Aspose API.
If required, we can raise this ticket through our corporate account.
To add your desired page breaks at your desired places and remove your unwanted page breaks via the APIs, these are your requirements based on your purely custom needs. How MS Excel or Aspose.Cells would know where to place page breaks for data in the worksheets for your needs. If you do not want to use scale (zoom), set fit to pages wide/tall or other Page Setup options, how could you perform your task in MS Excel automatically via some specific option(s), please elaborate with sample Excel file (where you did not use page scaling, fit to pages or other options)? We will check it soon.