/** * 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 IGridRegion findEmptyRect(int width, int height) { int lastRow = PoiExcelHelper.getLastRowNum(getSheet()); int top = lastRow + 2, left = 1; GridRegion newRegion = new GridRegion(top, left, top + height - 1, left + width - 1); if (IGridRegion.Tool.isValidRegion(newRegion, getSpreadsheetConstants())) { return newRegion; } return null; }