-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
None
-
None
Problem description
In common use case, we usually change few properties of print setup. But if we set one property of print setup in PdfExport, we will also lose all other print setup created in Excel. The current design will make this feature hard to use in real case.
For current design, there might be 2 issues:
- Users cannot just change one property of print setup based on original Excel print setup
- If we change a property in PdfExport's printsetup, it overrides all original Excel print setup.
- if we want to change one property of Excel's print setup in order to keep Excel's setup, we need to set it sheet by sheet, and manipulate internal object, SSheet
- There is no way to copy SSheet print setup to PdfExport's print setup.
Steps to Reproduce
- create PdfExporter and export a pdf without changing any print setup.
- change one property of print setup in PdfExporter, e.g. change the orientation from portrait to landscape
PdfExporter pdfExporter = new PdfExporter(); private SPrintSetup printSetup = pdfExporter.getPrintSetup(); printSetup.setLandscape(true); ... pdfExporter.export(book.getInternalBook(), file);
- use it to export a pdf file
- compare 2 exported pdf file.
Actual Result
Compare startzss.xlsx.pdf with startzss.xlsx -landscape.pdf, if a user just want to change orientation to "landscape", but he will also lose other default print setup like margin.
Workaround
copy internal sheet's print setup to pdf exporter in order to get Excel page setup.
SPrintSetup printSetup = ss.getBook().getSheetAt(0).getInternalSheet().getPrintSetup(); ((PrintSetupImpl)overridenPrintSetup).copyFrom((PrintSetupImpl)printSetup);