dhatim / fastexcel

Generate and read big Excel files quickly
Other
684 stars 122 forks source link

Set Active Tab of Workbook #130

Closed kappaOne closed 3 years ago

kappaOne commented 4 years ago

It would be helpful if you could add a feature to set the active tab of a workbook.

I would implement this by making the following changes to Workbook.java

private int activeTab = 0; // global variable

public void setActiveTab(int tab) {
    this.activeTab = tab;
}

And make the following change to line 187 in the private writeWorkbookFile method by changing "<workbookView activeTab=\"0\"/>" + to "<workbookView activeTab=\"" + activeTab + "\"/>" +

dorssar commented 3 years ago

Maybe this should be called on the Sheet object:

sheet.setActive() or sheet.keepInActiveTab() could set the activeTab in workbook which can then write it to xml

dorssar commented 3 years ago

implemented in #124