/** * Begins writing a table. * * @param width table width in cells * @param height table height in cells * * @throws CreateTableException if unable to create table * @throws IllegalStateException if <code>beginTable()</code> has already * been called without subsequent <code>endTable()</code> */ public void beginTable(int width, int height) throws CreateTableException { if (region != null) { throw new IllegalStateException("beginTable() has already been called"); } this.width = width; this.height = height; region = gridModel.findEmptyRect(width, height); if (region == null) { throw new CreateTableException("Could not find appropriate region for writing"); } currentRow = 0; style2style.clear(); }
/** * Begins writing a table within the specified region. * * @param regionToWrite region to write table. * * @throws CreateTableException if unable to create table * @throws IllegalStateException if <code>beginTable()</code> has already * been called without subsequent <code>endTable()</code> */ public void beginTable(IGridRegion regionToWrite) throws CreateTableException { if (region != null) { throw new IllegalStateException("beginTable() has already been called"); } region = regionToWrite; if (region == null || !IGridRegion.Tool.isValidRegion(region, gridModel.getSpreadsheetConstants())) { throw new CreateTableException("Could not find appropriate region for writing"); } currentRow = 0; style2style.clear(); }
public void save() throws CreateTableException { try { gridModel.getSheetSource().getWorkbookSource().save(); } catch (IOException e) { throw new CreateTableException("Could not save table. " + e.getMessage()); } }