Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.ss.util
Class WorkbookUtil

    java.lang.Object
      org.apache.poi.ss.util.WorkbookUtil

    public class WorkbookUtil

extends java.lang.Object

Helper methods for when working with Usermodel Workbooks

Constructor Summary
`WorkbookUtil()`

Method Summary
`static java.lang.String` | `createSafeSheetName(java.lang.String nameProposal)` Creates a valid sheet name, which is conform to the rules.
`static java.lang.String` | `createSafeSheetName(java.lang.String nameProposal, char replaceChar)` Creates a valid sheet name, which is conform to the rules.
`static void` | `validateSheetName(java.lang.String sheetName)` Validates sheet name.
`static void` | `validateSheetState(int state)` Deprecated. POI 3.16 beta 2. Use `SheetVisibility` instead.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WorkbookUtil

    public WorkbookUtil()

Method Detail

### createSafeSheetName

    public static final java.lang.String createSafeSheetName(java.lang.String nameProposal)

  Creates a valid sheet name, which is conform to the rules. In any case, the result safely can be used for `Workbook.setSheetName(int, String)`.
  Rules:
  - never null
  - minimum length is 1
  - maximum length is 31
  - doesn't contain special chars: : 0x0000, 0x0003, / \ ? * ] [
  - Sheet names must not begin or end with ' (apostrophe)
  Invalid characters are replaced by one space character ' '.

  Parameters:
    `nameProposal` - can be any string, will be truncated if necessary, allowed to be null
  Returns:
    a valid string, "empty" if to short, "null" if null

### createSafeSheetName

    public static final java.lang.String createSafeSheetName(java.lang.String nameProposal,
                                                             char replaceChar)

  Creates a valid sheet name, which is conform to the rules. In any case, the result safely can be used for `Workbook.setSheetName(int, String)`.
  Rules:
  - never null
  - minimum length is 1
  - maximum length is 31
  - doesn't contain special chars: : 0x0000, 0x0003, / \ ? * ] [
  - Sheet names must not begin or end with ' (apostrophe)

  Parameters:
    `nameProposal` - can be any string, will be truncated if necessary, allowed to be null
    `replaceChar` - the char to replace invalid characters.
  Returns:
    a valid string, "empty" if to short, "null" if null

### validateSheetName

    public static void validateSheetName(java.lang.String sheetName)

  Validates sheet name.

  The character count `MUST` be greater than or equal to 1 and less than or equal to 31. The string MUST NOT contain the any of the following characters:

  - 0x0000
  - 0x0003
  - colon (:)
  - backslash (\)
  - asterisk (*)
  - question mark (?)
  - forward slash (/)
  - opening square bracket ([)
  - closing square bracket (])
  The string MUST NOT begin or end with the single quote (') character.

  Parameters:
    `sheetName` - the name to validate
  Throws:
    `java.lang.IllegalArgumentException` - if validation fails

### validateSheetState

    @Removal(version="3.18")
    @Deprecated
    public static void validateSheetState(int state)

  Deprecated. POI 3.16 beta 2. Use `SheetVisibility` instead.

  Validates sheet state

  Parameters:
    `state` - the state to validate
  Throws:
    `java.lang.IllegalArgumentException` - if state is not one of `Workbook.SHEET_STATE_VISIBLE`, `Workbook.SHEET_STATE_HIDDEN` or `Workbook.SHEET_STATE_VERY_HIDDEN`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.