Hi,
Scenario:
It appears that when generating PDF files from excel, the page height was being set wrongly when the PdfSaveOptions AllColumnsInOnePagePerSheet is set to true.
When the PdfSaveOptions OnePagePerSheet is set to true, the content displayed are being sized correctly such that when there are only few rows of data, the page height is set to only display the few rows.
However, OnePagePerSheet does not cater for long sheets such that when one sheet containing over 15000 rows of data, the page will be over-sized and hard to be viewed.
Below are my questions:
-
Is there any way to set the page height dynamically caters both when there are many data and when there is too less data?
Such that use generated page height when there are too many data and display only few rows of data like OnePagePerSheet when there is too less data. (Handling sheets differently) -
Example [excel]: Sheet1 contains 5 rows of data. Sheet2 contains 15000 rows of data.
Expected output: Page1’s page height dynamically sized according to number of rows. Page2 automatically separates the data into multiple pages. (Or at least displaying it with minimum page size of what is being set by Excel’s paper size).
Sample Code:
var pdfSaveOptions = new PdfSaveOptions
{
OnePagePerSheet = false,
AllColumnsInOnePagePerSheet = true,
CalculateFormula = false
};
workbook.Save(pdfPath, pdfSaveOptions);
Attachments:
None.pdf have both option OnePagePerSheet and AllColumnsInOnePagePerSheet disabled
AllColumnsInOnePagePerSheet.pdf have OnePagePerSheet disabled and AllColumnsInOnePagePerSheet enabled
OnePagePerSheet.pdf have both option OnePagePerSheet and AllColumnsInOnePagePerSheet enabled
Sample Excel and output.zip (102.0 KB)
Aspose.Cells version 21.6.0
Hope my questions are clear.
Thanks in advance.