/** * 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); }
/** * 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); } }
@Override public short getLeftCol() { String cellRef = worksheet.getSheetViews().getSheetViewArray(0).getTopLeftCell(); if(cellRef == null) { return 0; } CellReference cellReference = new CellReference(cellRef); return cellReference.getCol(); }
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"); } } } }
/** * 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); } }
/** * 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); }
/** * 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); } }
/** * 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); }
@Override public short getLeftCol() { String cellRef = worksheet.getSheetViews().getSheetViewArray(0).getTopLeftCell(); if(cellRef == null) { return 0; } CellReference cellReference = new CellReference(cellRef); return cellReference.getCol(); }
public short getLeftCol() { String cellRef = worksheet.getSheetViews().getSheetViewArray(0).getTopLeftCell(); CellReference cellReference = new CellReference(cellRef); return cellReference.getCol(); }
private XSSFSheet preprocess(XSSFSheet sheet) { for (CTSheetView v : sheet.getCTWorksheet().getSheetViews().getSheetViewArray()) { v.setShowGridLines(showGridLines); v.setShowRuler(showRuler); v.setTabSelected(sheet.getWorkbook().getSheetIndex(sheet) == 0); v.setShowRowColHeaders(showRowColHeaders); if (removeSelection) { for (CTSelection s : v.getSelectionArray()) { v.removeSelection(0); } } } return sheet; }