Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-668

Xlsx exporter always set the last sheet as active after KEIKAI-486

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 6.0.0
    • 5.11.0
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Import an empty excel sheet with 3 tabs (sample attached defaulttab.xlsx).

      Before importing the active sheet is sheet 1

      immediately exporter the same book with excel exporter

      Current Result

      When opening the file in Excel, the last visible sheet is always set as active (sheet 3).

      In addition, sheet 1 is not active, but is selected

      Expected Result

      Sheet 1 should still be the active sheet

      Debug Information

      In Excel exporter io.keikai.range.impl.imexp.AbstractExcelExporter.export(SBook, OutputStream)

                      if (sheet.getSheetVisible() == SSheet.SheetVisible.VISIBLE || sheet.getViewInfo().isTabSelected()) {
                          _exportPhase.setPhase(ExportPhase.SHEET_ACTIVE);
                          workbook.setActiveSheet(n);
                          _exportPhase.setPhase(ExportPhase.SHEET);
                      }

      workbook.setActiveSheet( n ) is called on every sheet that is either visible (as in, not hidden in the sheet list), or currently selected.

      This means that this line is called for every sheet that is not specifically hidden, which always sets the last "non hidden" sheet as the active sheet, even though this is not the same active sheet a imported.

      Workaround

      replace exporter (attached)

            DevChu DevChu
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: