Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-827

Change PdfExporter print setup's one property but it will lose original Excel print setup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.7.0
    • 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:

      1. Users cannot just change one property of print setup based on original Excel print setup
        1. If we change a property in PdfExport's printsetup, it overrides all original Excel print setup.
        2. 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
        3. There is no way to copy SSheet print setup to PdfExport's print setup.

      Steps to Reproduce

      1. create PdfExporter and export a pdf without changing any print setup.
      2. 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);
        
      3. use it to export a pdf file
      4. 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);
      

        1. startzss.xlsx
          63 kB
        2. startzss.xlsx.pdf
          124 kB
        3. startzss.xlsx -landscape.pdf
          505 kB

            henrichen henrichen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: