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.hssf.usermodel
Class HSSFOptimiser

    java.lang.Object
      org.apache.poi.hssf.usermodel.HSSFOptimiser

    public class HSSFOptimiser

extends java.lang.Object

Excel can get cranky if you give it files containing too many (especially duplicate) objects, and this class can help to avoid those. In general, it's much better to make sure you don't duplicate the objects in your code, as this is likely to be much faster than creating lots and lots of excel objects+records, only to optimise them down to many fewer at a later stage. However, sometimes this is too hard / tricky to do, which is where the use of this class comes in.

Constructor Summary
`HSSFOptimiser()`

Method Summary
`static void` | `optimiseCellStyles(HSSFWorkbook workbook)` Goes through the Wokrbook, optimising the cell styles by removing duplicate ones.
`static void` | `optimiseFonts(HSSFWorkbook workbook)` Goes through the Workbook, optimising the fonts by removing duplicate ones.

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

Constructor Detail

### HSSFOptimiser

    public HSSFOptimiser()

Method Detail

### optimiseFonts

    public static void optimiseFonts(HSSFWorkbook workbook)

  Goes through the Workbook, optimising the fonts by removing duplicate ones. For now, only works on fonts used in `HSSFCellStyle` and `HSSFRichTextString`. Any other font uses (eg charts, pictures) may well end up broken! This can be a slow operation, especially if you have lots of cells, cell styles or rich text strings

  Parameters:
    `workbook` - The workbook in which to optimise the fonts

### optimiseCellStyles

    public static void optimiseCellStyles(HSSFWorkbook workbook)

  Goes through the Wokrbook, optimising the cell styles by removing duplicate ones. For best results, optimise the fonts via a call to `optimiseFonts(HSSFWorkbook)` first.

  Parameters:
    `workbook` - The workbook in which to optimise the cell styles

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