Skip to content

Commit

Permalink
always set safe sheet name
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed Oct 13, 2015
1 parent 5bf85bc commit cc44233
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.modelcatalogue.builder.spreadsheet.poi

import groovy.transform.stc.ClosureParams
import groovy.transform.stc.FromString
import org.apache.poi.ss.util.WorkbookUtil
import org.apache.poi.xssf.usermodel.XSSFCell
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFWorkbook
Expand All @@ -22,7 +23,7 @@ class PoiWorkbook implements Workbook {

@Override
void sheet(String name, @DelegatesTo(Sheet.class) @ClosureParams(value=FromString.class, options = "org.modelcatalogue.builder.spreadsheet.api.Sheet") Closure sheetDefinition) {
XSSFSheet xssfSheet = workbook.getSheet(name) ?: workbook.createSheet(name)
XSSFSheet xssfSheet = workbook.getSheet(WorkbookUtil.createSafeSheetName(name)) ?: workbook.createSheet(WorkbookUtil.createSafeSheetName(name))

PoiSheet sheet = new PoiSheet(this, xssfSheet)
sheet.with sheetDefinition
Expand Down

0 comments on commit cc44233

Please sign in to comment.