/** * Sets a flag indicating whether this sheet is selected. * * <p> * When only 1 sheet is selected and active, this value should be in synch with the activeTab value. * In case of a conflict, the Start Part setting wins and sets the active sheet tab. * </p> * Note: multiple sheets can be selected, but only one sheet can be active at one time. * * @param value <code>true</code> if this sheet is selected */ @Override public void setSelected(boolean value) { final CTSheetViews views = getSheetTypeSheetViews(true); assert(views != null); for (CTSheetView view : views.getSheetViewArray()) { view.setTabSelected(value); } }
protected CTSheetViews getSheetTypeSheetViews(final boolean create) { final CTSheetViews views = (worksheet.isSetSheetViews() || !create) ? worksheet.getSheetViews() : worksheet.addNewSheetViews(); assert(views != null || !create); if (views == null) { return null; } if (views.sizeOfSheetViewArray() == 0 && create) { views.addNewSheetView(); } return views; }
/** * Return the default sheet view. This is the last one if the sheet's views, according to sec. 3.3.1.83 * of the OOXML spec: "A single sheet view definition. When more than 1 sheet view is defined in the file, * it means that when opening the workbook, each sheet view corresponds to a separate window within the * spreadsheet application, where each window is showing the particular sheet. containing the same * workbookViewId value, the last sheetView definition is loaded, and the others are discarded. * When multiple windows are viewing the same sheet, multiple sheetView elements (with corresponding * workbookView entries) are saved." */ private CTSheetView getDefaultSheetView(final boolean create) { final CTSheetViews views = getSheetTypeSheetViews(create); assert(views != null || !create); if (views == null) { return null; } final int sz = views.sizeOfSheetViewArray(); assert(sz > 0 || !create); return (sz == 0) ? null : views.getSheetViewArray(sz - 1); }
protected CTSheetViews getSheetTypeSheetViews() { if (dialogsheet.getSheetViews() == null) { dialogsheet.setSheetViews(CTSheetViews.Factory.newInstance()); dialogsheet.getSheetViews().addNewSheetView(); } return dialogsheet.getSheetViews(); }
private CTSheetView getSheetTypeSheetView() { if (getDefaultSheetView() == null) { getSheetTypeSheetViews().setSheetViewArray(0, CTSheetView.Factory.newInstance()); } return getDefaultSheetView(); }
/** * Return the default sheet view. This is the last one if the sheet's views, according to sec. 3.3.1.83 * of the OOXML spec: "A single sheet view definition. When more than 1 sheet view is defined in the file, * it means that when opening the workbook, each sheet view corresponds to a separate window within the * spreadsheet application, where each window is showing the particular sheet. containing the same * workbookViewId value, the last sheetView definition is loaded, and the others are discarded. * When multiple windows are viewing the same sheet, multiple sheetView elements (with corresponding * workbookView entries) are saved." */ private CTSheetView getDefaultSheetView() { CTSheetViews views = getSheetTypeSheetViews(); int sz = views == null ? 0 : views.sizeOfSheetViewArray(); if (sz == 0) { return null; } return views.getSheetViewArray(sz - 1); }
/** * Create a new CTWorksheet instance with all values set to defaults * * @return a new instance */ private static CTWorksheet newSheet(){ CTWorksheet worksheet = CTWorksheet.Factory.newInstance(); CTSheetFormatPr ctFormat = worksheet.addNewSheetFormatPr(); ctFormat.setDefaultRowHeight(DEFAULT_ROW_HEIGHT); CTSheetView ctView = worksheet.addNewSheetViews().addNewSheetView(); ctView.setWorkbookViewId(0); worksheet.addNewDimension().setRef("A1"); worksheet.addNewSheetData(); CTPageMargins ctMargins = worksheet.addNewPageMargins(); ctMargins.setBottom(DEFAULT_MARGIN_BOTTOM); ctMargins.setFooter(DEFAULT_MARGIN_FOOTER); ctMargins.setHeader(DEFAULT_MARGIN_HEADER); ctMargins.setLeft(DEFAULT_MARGIN_LEFT); ctMargins.setRight(DEFAULT_MARGIN_RIGHT); ctMargins.setTop(DEFAULT_MARGIN_TOP); return worksheet; }
@Override public short getLeftCol() { String cellRef = worksheet.getSheetViews().getSheetViewArray(0).getTopLeftCell(); if(cellRef == null) { return 0; } CellReference cellReference = new CellReference(cellRef); return cellReference.getCol(); }
/** * Return the default sheet view. This is the last one if the sheet's views, according to sec. 3.3.1.83 * of the OOXML spec: "A single sheet view definition. When more than 1 sheet view is defined in the file, * it means that when opening the workbook, each sheet view corresponds to a separate window within the * spreadsheet application, where each window is showing the particular sheet. containing the same * workbookViewId value, the last sheetView definition is loaded, and the others are discarded. * When multiple windows are viewing the same sheet, multiple sheetView elements (with corresponding * workbookView entries) are saved." */ private CTSheetView getDefaultSheetView(final boolean create) { final CTSheetViews views = getSheetTypeSheetViews(create); assert(views != null || !create); if (views == null) { return null; } final int sz = views.sizeOfSheetViewArray(); assert(sz > 0 || !create); return (sz == 0) ? null : views.getSheetViewArray(sz - 1); }
protected CTSheetViews getSheetTypeSheetViews(final boolean create) { final CTSheetViews views = (worksheet.isSetSheetViews() || !create) ? worksheet.getSheetViews() : worksheet.addNewSheetViews(); assert(views != null || !create); if (views == null) { return null; } if (views.sizeOfSheetViewArray() == 0 && create) { views.addNewSheetView(); } return views; }
protected CTSheetViews getSheetTypeSheetViews() { if (dialogsheet.getSheetViews() == null) { dialogsheet.setSheetViews(CTSheetViews.Factory.newInstance()); dialogsheet.getSheetViews().addNewSheetView(); } return dialogsheet.getSheetViews(); }
if (sheet instanceof XSSFSheet) { final CTWorksheet workSheet = ((XSSFSheet) sheet).getCTWorksheet(); if (workSheet != null) { final CTSheetViews views = workSheet.getSheetViews(); if (views != null) { if (views.getSheetViewArray(0) != null) { views.getSheetViewArray(0).setTopLeftCell("A1"); } } } }
protected CTSheetViews getSheetTypeSheetViews() { if (dialogsheet.getSheetViews() == null) { dialogsheet.setSheetViews(CTSheetViews.Factory.newInstance()); dialogsheet.getSheetViews().addNewSheetView(); } return dialogsheet.getSheetViews(); }
/** * Sets a flag indicating whether this sheet is selected. * * <p> * When only 1 sheet is selected and active, this value should be in synch with the activeTab value. * In case of a conflict, the Start Part setting wins and sets the active sheet tab. * </p> * Note: multiple sheets can be selected, but only one sheet can be active at one time. * * @param value <code>true</code> if this sheet is selected */ @SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support public void setSelected(boolean value) { CTSheetViews views = getSheetTypeSheetViews(); for (CTSheetView view : views.getSheetViewArray()) { view.setTabSelected(value); } }
private CTSheetViews getSheetTypeSheetViews() { if (worksheet.getSheetViews() == null) { worksheet.setSheetViews(CTSheetViews.Factory.newInstance()); worksheet.getSheetViews().addNewSheetView(); } return worksheet.getSheetViews(); }
/** * Sets a flag indicating whether this sheet is selected. * * <p> * When only 1 sheet is selected and active, this value should be in synch with the activeTab value. * In case of a conflict, the Start Part setting wins and sets the active sheet tab. * </p> * Note: multiple sheets can be selected, but only one sheet can be active at one time. * * @param value <code>true</code> if this sheet is selected */ @Override public void setSelected(boolean value) { final CTSheetViews views = getSheetTypeSheetViews(true); assert(views != null); for (CTSheetView view : views.getSheetViewArray()) { view.setTabSelected(value); } }
/** * Create a new CTWorksheet instance with all values set to defaults * * @return a new instance */ private static CTWorksheet newSheet(){ CTWorksheet worksheet = CTWorksheet.Factory.newInstance(); CTSheetFormatPr ctFormat = worksheet.addNewSheetFormatPr(); ctFormat.setDefaultRowHeight(DEFAULT_ROW_HEIGHT); CTSheetView ctView = worksheet.addNewSheetViews().addNewSheetView(); ctView.setWorkbookViewId(0); worksheet.addNewDimension().setRef("A1"); worksheet.addNewSheetData(); CTPageMargins ctMargins = worksheet.addNewPageMargins(); ctMargins.setBottom(DEFAULT_MARGIN_BOTTOM); ctMargins.setFooter(DEFAULT_MARGIN_FOOTER); ctMargins.setHeader(DEFAULT_MARGIN_HEADER); ctMargins.setLeft(DEFAULT_MARGIN_LEFT); ctMargins.setRight(DEFAULT_MARGIN_RIGHT); ctMargins.setTop(DEFAULT_MARGIN_TOP); return worksheet; }
@Override public short getLeftCol() { String cellRef = worksheet.getSheetViews().getSheetViewArray(0).getTopLeftCell(); if(cellRef == null) { return 0; } CellReference cellReference = new CellReference(cellRef); return cellReference.getCol(); }
/** * Create a new CTWorksheet instance with all values set to defaults * * @return a new instance */ private static CTWorksheet newSheet(){ CTWorksheet worksheet = CTWorksheet.Factory.newInstance(); CTSheetFormatPr ctFormat = worksheet.addNewSheetFormatPr(); ctFormat.setDefaultRowHeight(15.0); CTSheetView ctView = worksheet.addNewSheetViews().addNewSheetView(); ctView.setWorkbookViewId(0); worksheet.addNewDimension().setRef("A1"); worksheet.addNewSheetData(); CTPageMargins ctMargins = worksheet.addNewPageMargins(); ctMargins.setBottom(0.75); ctMargins.setFooter(0.3); ctMargins.setHeader(0.3); ctMargins.setLeft(0.7); ctMargins.setRight(0.7); ctMargins.setTop(0.75); return worksheet; }
public short getLeftCol() { String cellRef = worksheet.getSheetViews().getSheetViewArray(0).getTopLeftCell(); CellReference cellReference = new CellReference(cellRef); return cellReference.getCol(); }