/** * Set the sheetname for this sheet. (this appears in the tabs at the bottom) * @param sheetName the name of the sheet * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal) * for a safe way to create valid names * @throws IllegalArgumentException if sheet name will cause excel to crash. */ public void setSheetname(String sheetName) { WorkbookUtil.validateSheetName(sheetName); field_5_sheetname = sheetName; field_4_isMultibyteUnicode = StringUtil.hasMultibyte(sheetName) ? 1 : 0; }
sheetname = sheetname.substring(0, 31); WorkbookUtil.validateSheetName(sheetname);
sheetname = sheetname.substring(0, 31); WorkbookUtil.validateSheetName(sheetname);
/** * Set the sheetname for this sheet. (this appears in the tabs at the bottom) * @param sheetName the name of the sheet * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal) * for a safe way to create valid names * @throws IllegalArgumentException if sheet name will cause excel to crash. */ public void setSheetname(String sheetName) { WorkbookUtil.validateSheetName(sheetName); field_5_sheetname = sheetName; field_4_isMultibyteUnicode = StringUtil.hasMultibyte(sheetName) ? 1 : 0; }
/** * Set the sheetname for this sheet. (this appears in the tabs at the bottom) * @param sheetName the name of the sheet * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal) * for a safe way to create valid names * @throws IllegalArgumentException if sheet name will cause excel to crash. */ public void setSheetname(String sheetName) { WorkbookUtil.validateSheetName(sheetName); field_5_sheetname = sheetName; field_4_isMultibyteUnicode = StringUtil.hasMultibyte(sheetName) ? 1 : 0; }
/** * Set the sheetname for this sheet. (this appears in the tabs at the bottom) * @param sheetName the name of the sheet * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal) * for a safe way to create valid names * @throws IllegalArgumentException if sheet name will cause excel to crash. */ public void setSheetname(String sheetName) { WorkbookUtil.validateSheetName(sheetName); field_5_sheetname = sheetName; field_4_isMultibyteUnicode = StringUtil.hasMultibyte(sheetName) ? 1 : 0; }
/** * Set the sheet name. * * @param sheetIndex sheet number (0 based) * @param sheetname the new sheet name * @throws IllegalArgumentException if the name is null or invalid * or workbook already contains a sheet with this name * @see #createSheet(String) * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal) */ public void setSheetName(int sheetIndex, String sheetname) { validateSheetIndex(sheetIndex); // YK: Mimic Excel and silently truncate sheet names longer than 31 characters if(sheetname != null && sheetname.length() > 31) sheetname = sheetname.substring(0, 31); WorkbookUtil.validateSheetName(sheetname); if (containsSheet(sheetname, sheetIndex )) throw new IllegalArgumentException( "The workbook already contains a sheet of this name" ); XSSFFormulaUtils utils = new XSSFFormulaUtils(this); utils.updateSheetName(sheetIndex, sheetname); workbook.getSheets().getSheetArray(sheetIndex).setName(sheetname); }
sheetname = sheetname.substring(0, 31); WorkbookUtil.validateSheetName(sheetname);
WorkbookUtil.validateSheetName(sheetname);
sheetname = sheetname.substring(0, 31); WorkbookUtil.validateSheetName(sheetname);