Class Sheet
Workbook
(it follows the tab when other tabs are inserted, moved or deleted). Holds no
native resource; all work goes through the owning Workbook's handle.
Use range(int, int, int, int) for bulk cell access (Range crosses JNI once
per rectangle). value(int, int) is a single-cell convenience.
-
Method Summary
Modifier and TypeMethodDescriptionThe sheet view's active cell as an A1 reference (<sheetView><selection activeCell>, ECMA-376 §18.3.1.78), ornullwhen the sheet carries no selection at all.intAdd a chart to this sheet; returns the new chart's index.intaddCheckbox(String name, int fromRow, int fromColumn, int toRow, int toColumn, String linkedCell) Add a checkbox form control anchored to a two-cell rectangle, optionally bound to a linked cell (A1 ref) reflecting its state.voidaddColumnPageBreak(int column) Insert a manual page break beforecolumn(vertical break).intaddConnector(String preset, int fromRow, int fromCol, int toRow, int toCol) Add a connector shape (<xdr:cxnSp>) with the given preset geometry name (e.g.intaddFormControl(FormControl control) Add a form control (check box, option button, button, combo box, list box, scroll bar, spin button, edit box, label, group box); returns its index informControls().intaddLinkedPicture(String target, String format, int r1, int c1, int r2, int c2) Add a linked picture over the rectangle(r1,c1)..(r2,c2): the image is referenced by an externaltarget(URL or path) via<a:blip r:link>instead of embedding bytes (ECMA-376 Part 1 §20.1.8.13).intaddPicture(byte[] imageData, String format, int fromRow, int fromColumn, int toRow, int toColumn) Insert an image anchored to a two-cell rectangle (0-based cells).intaddPicture(byte[] imageData, String format, int fromRow, int fromColumn, int fromRowOffset, int fromColumnOffset, int toRow, int toColumn, int toRowOffset, int toColumnOffset) Insert an image with a full two-cell anchor including EMU offsets.intaddPivotChart(int pivotIndex, String chartType, int fromRow, int fromCol, int toRow, int toCol) Add a PivotChart bound to the pivot table atpivotIndexon this sheet, anchored over the given cell rectangle.intaddPivotTable(String name, String location, String sourceRef) Create a pivot table atlocation(A1 anchor) over a source range; returns its index.voidaddProtectedRange(String name, String sqref) Adds an ungated allow-edit-range.voidaddProtectedRange(String name, String sqref, String password) Adds an allow-users-to-edit-range (protectedRange— ECMA-376 Part 1 §18.3.1.72): the named rangesqrefstays editable while the sheet is protected.voidaddRowPageBreak(int row) Insert a manual page break beforerow(horizontal break).intaddScenario(String name, String[] cellRefs, String[] values) Add a what-if scenario; returns its index.intAdd a drawing shape (e.g.intaddSparkline(String type, String dataRef, String locationRef) Add a sparkline group ("line","column", or"stacked") that drawsdataRef(e.g.intaddTextBox(String text, int fromRow, int fromCol, int toRow, int toCol) Add a text box (arectshape carryingtext); returns the new shape's index.booleananchorOleObject(int objectIndex, byte[] iconBytes, String iconFormat, int fromRow, int fromCol, int toRow, int toCol) Display the workbook-level embedded OLE object atobjectIndex(seeWorkbook.addOleObject(java.lang.String, java.lang.String, byte[])) as an icon on this sheet, anchored over the cell rectangle(fromRow, fromCol)–(toRow, toCol)(0-based, exclusive bottom-right edge like a drawing anchor).intapplyAdvancedFilter(Range listRange, Range criteriaRange, boolean uniqueOnly) Run an advanced filter (Excel's Data > Advanced) overlistRangein place, hiding the data rows that do not matchcriteriaRange.intapplyAdvancedFilterCopyTo(Range listRange, Range criteriaRange, Range destination, boolean uniqueOnly) Advanced filter in "Copy to another location" mode: instead of hiding source rows, writes the list header plus each matching row (seeapplyAdvancedFilter(Range, Range, boolean)for the criteria semantics) starting at the top-left cell ofdestination.intExecute the auto-filter: hides every data row failing any column's criteria and shows the rest.booleanautoExpandTables(int row, int col, String typedText) Apply Excel's type-adjacent table auto-expansion for a data entry at (row,col): typing one row below a table's last data row (inside its column span, no totals row) grows it by one row; typing in the header row one column right of its last column grows it by one column namedtypedText— unless another table occupies the candidate column.The filtered block, ornullwhen this sheet has no autofilter.voidautoFitColumn(int col) Auto-fit a column's width to its widest cell value.voidautoFitRow(int row) Auto-fit a row's height from the default font size.byte[]The raw bytes of the sheet background image, ornullwhen none.The format token (png/jpeg/…) of the sheet background image, ornullwhen none.intThe declaredbaseColWidthbasis in characters, or0when the sheet does not declare one (the spec default of 8 applies).cell(int row, int col) A single-cell view at(row, col)(0-based).chart(int chartIndex) A live view of the chart atchartIndex(its position incharts()), with read-back getters and setters that apply immediately.charts()All charts on this sheet.voidRemove any auto-filter.booleanRemove the sheet background image; returns whether one existed.voidRemove all charts from this sheet.voidclearColumnFilter(int columnIndex) Remove the filter from a single column.voidRemove all conditional-formatting rules from this sheet.voidRemove all manual page breaks.voidRemove the explicit paper-size declaration, so the saved sheet omits thepaperSizeattribute and consumers use their printer default.voidRemove all pictures from this sheet.voidRemove all data-validation rules from this sheet.int[]The manual vertical page-break columns.columnStyle(int col) The style applied to the entire column — the default for cells in the column that carry no cell-level style (<col style>).intcolumnStyleId(int col) The column-level style id (an engine-internal dedup index, matchingRange.styleIds()), or0when the column carries no column-level style.doublecolumnWidth(int col) A column's width in character units.All conditional-formatting rules on this sheet.int[]consolidate(int destRow, int destColumn, ConsolidateFunction function, Range... sources) Consolidate several equally-shaped source ranges (possibly on other sheets) into this sheet at(destRow, destColumn)usingfunction, aggregating by position.booleanconvertTableToRange(String name) Convert the named table back to an ordinary range (Excel's Table Design > Convert to Range): drops the table definition while keeping every cell value in place.doubleThe sheet's explicit default column width in character units, or0when none is declared — column widths then derive frombaseColumnWidth().doubleThe sheet's default row height in points — the height of every row without an explicitsetRowHeight(int, double)override.voiddeleteColumns(int startCol, int count) Deletecountcolumns starting atstartCol.voiddeleteRows(int startRow, int count) Deletecountrows starting atstartRow.booleanWhether the first printed page uses its own header/footer (ECMA-376 §18.3.1.46differentFirst).booleanWhether odd and even printed pages use distinct headers/footers (ECMA-376 §18.3.1.46differentOddEven).doubleThe sheet-levelx14ac:dyDescenttext-descent hint on<sheetFormatPr>, or0when absent.The even-page footer text, ornull(only used whendifferentOddEven()).The even-page header text, ornull(only used whendifferentOddEven()).int[][]Find all cells whose text matches, as{row, col}pairs.int[][]Find with options.int[][]find(String text, boolean caseSensitive, boolean matchEntire, boolean wildcard, FindFormat format) find(String, FindFormat)with the full option set.int[][]find(String text, FindFormat format) Find restricted to cells whose resolved style matchesformat(Excel's search-by-format) — seeFindFormatfor the matching semantics.int[][]Find all cells whose text matches the regular expressionpattern(case-insensitive), as{row, col}pairs.int[][]findRegex(String)with explicit case sensitivity.The first-page footer text, ornull(only used whendifferentFirst()).The first-page header text, ornull(only used whendifferentFirst()).intThe number printed on the first page, or0when unset.intPages tall the printout is fitted to (0= automatic / unlimited); only meaningful whenisFitToPage().voidfitToPage(int width, int height) Fit the printout towidthpages wide byheighttall.intPages wide the printout is fitted to (0= automatic / unlimited); only meaningful whenisFitToPage().footer()The page footer text, ornull.int[]The 0-based indexes (ascending) of columns carrying explicit column-level metadata — width, hidden flag, column style or outline.int[]0-based indexes of the rows carrying explicit row-level metadata — a custom height, a hidden flag, or a row style — the row analogue offormattedColumns().intAll form controls on this sheet, in z-order.intThe frozen column split (columns left are frozen); 0 if none.voidfreezePanes(int freezeRow, int freezeCol) Freeze rows abovefreezeRowand columns left offreezeCol.intThe frozen row split (rows above are frozen); 0 if none.voidgroupColumns(int startCol, int endCol) Group columns[startCol, endCol]at outline level 1.voidgroupRows(int startRow, int endRow) Group rows[startRow, endRow]at outline level 1.intgroupShapes(String name, int... shapeIndexes) Group existing shapes into one<xdr:grpSp>container (Excel's "Group").booleanbooleanWhether the sheet carries a<pageSetup>element (ECMA-376 §18.3.1.63).header()The page header text (Excel codes like&C,&Pallowed), ornull.byte[]headerFooterPictureData(String section) The image bytes of the header/footer picture insection, ornull.<T> intimportData(int startRow, int startCol, List<T> items) Import a collection with default options (header row on, all properties).<T> intimportData(int startRow, int startCol, List<T> items, ImportOptions options) Import a collection of Java objects into a range.intindex()The 0-based index of this sheet in its workbook — its position NOW.voidinsertColumns(int startCol, int count) Insertcountblank columns beforestartCol.voidinsertRows(int startRow, int count) Insertcountblank rows beforestartRow.booleanisColumnHidden(int col) booleanisColumnWidthCustom(int col) Whether the column's width was explicitly authored (viasetColumnWidth(int, double)or a<col width>in the source file), as opposed to inheriting the sheet default.booleanWhether the default row height is flagged as an explicit, honoured value (thesheetFormatPr customHeightflag).booleanWhether fit-to-page scaling is active (set byfitToPage(int, int)); whenfalsethe sheet prints atpageScale().booleanbooleanWhether this sheet explicitly declares a paper size.booleanWhether this sheet is protected.booleanWhether the sheet's protection carries a password.booleanisRowHeightCustom(int row) Whether the row's height was explicitly authored (viasetRowHeight(int, double)or a<row ht>in the source file).booleanisRowHidden(int row) The merged-cell regions on this sheet.name()The sheet's display name.The page margins in inches.booleanWhether pages print over-then-down.intThe print scale percentage (100 = no scaling).intThe paper size as its ECMA-376 numeric code (9 = A4 by default).int[]pictureAnchor(int pictureIndex) {fromRow, fromCol, toRow, toCol}anchor of the picture, or an empty array.int[]pictureAnchorFull(int pictureIndex) {fromRow, fromCol, fromRowOffset, fromColOffset, toRow, toCol, toRowOffset, toColOffset}anchor of the picture (EMU offsets included), or an empty array.intNumber of pictures on this sheet.byte[]pictureData(int pictureIndex) The raw image bytes of the picture atpictureIndex, ornull.pictureFormat(int pictureIndex) The format token (png/jpeg/…) of the picture atpictureIndex, ornull.pictureLinkTarget(int pictureIndex) The external link target of the picture atpictureIndex, ornullwhen it is an ordinary embedded picture.intpivotLocation(int pivotIndex) The destination location (e.g.pivotName(int pivotIndex) pivotSource(int pivotIndex) The source data reference of the pivot table atpivotIndex.pivotTable(int pivotIndex) A live view of the pivot table atpivotIndex: field areas (row / column / filter / values), aggregation functions, layout, grand totals, andPivotTableView.refresh().pivotTable(String name) A live view of the pivot table namedname(exact match first, then case-insensitive).booleanWhether the sheet prints without colour.intWhere cell comments print, as the same codesetPrintComments(int)takes.booleanWhether the sheet prints in draft quality.intHow error cells print, as the same codesetPrintErrors(int)takes.booleanWhether gridlines are printed (ECMA-376 §18.3.1.65 printOptions/gridLines).booleanWhether row and column headings are printed.booleanWhether printed output is centered horizontally on the page (<printOptions horizontalCentered>, ECMA-376 §18.3.1.70).intThe printer resolution in DPI.booleanWhether printed output is centered vertically on the page (<printOptions verticalCentered>, ECMA-376 §18.3.1.70).voidprotect()Enable sheet protection (Excel-default allowances).voidEnable sheet protection with a password (ISO Write Protection hash, SHA-512 + 100,000 spins per [MS-OFFCRYPTO] §2.4.2.2) and Excel's default allowances.voidprotect(String password, SheetProtection options) Enable sheet protection with explicit ECMA-376 §18.3.1.85 options and an optional password (null= none).The sheet's allow-edit-ranges, in definition order.The protection options (allow semantics), ornullwhen this sheet is not protected.range(int r1, int c1, int r2, int c2) A range over the inclusive rectangle(r1,c1)..(r2,c2), 0-based.A range parsed from A1 notation, e.g.booleanremoveChart(int chartIndex) Remove the chart atchartIndex(its position incharts()); returns whether it existed.booleanremoveConditionalFormat(int formatIndex) Remove the conditional-formatting rule atformatIndex(its position inconditionalFormats()); returns whether it existed.booleanremoveFormControl(int controlIndex) Remove the form control atcontrolIndex(its position informControls()); returns whether it existed.booleanremoveHeaderFooterPicture(String section) Remove the header/footer picture insection; returns whether one existed.booleanremovePicture(int pictureIndex) Remove the picture atpictureIndex(0-based, the same index used bypictureData(int)); returns whether it existed.booleanremoveProtectedRange(String name) Removes the allow-edit-rangename; returns whether it existed.booleanremoveShape(int shapeIndex) Remove the shape atshapeIndex(0-based, the same index used byshapeType(int)); returns whether it existed.booleanremoveTable(String name) Remove the table with the given name; returns whether any matched.booleanremoveValidation(int validationIndex) Remove the data-validation rule atvalidationIndex(its position invalidations()); returns whether it existed.byte[]renderChartToPng(int chartIndex, int width, int height) Render the chart atchartIndexto PNG image bytes at the given pixel size, ornullif the index is out of range.renderChartToSvg(int chartIndex, int width, int height) Render the chart atchartIndexto a standalone SVG document at the given pixel size, ornullif the index is out of range.intreplaceAll(String find, String replace) Replace text in all matching cells; returns the number replaced.intreplaceAll(String find, String replace, boolean caseSensitive, boolean matchEntire, boolean wildcard) Replace with options.intreplaceAll(String find, String replace, boolean caseSensitive, boolean matchEntire, boolean wildcard, FindFormat format) replaceAll(String, String, FindFormat)with the full option set.intreplaceAll(String find, String replace, FindFormat format) Replace restricted to cells whose resolved style matchesformat— seeFindFormatfor the matching semantics.intreplaceAllRegex(String pattern, String replacement) Replace every match of the regular expressionpattern(case-insensitive) withreplacement, which may reference capture groups ("$1","${name}").intreplaceAllRegex(String pattern, String replacement, boolean caseSensitive) replaceAllRegex(String, String)with explicit case sensitivity.voidreplaceChart(int chartIndex, Chart chart) Applychart's spec onto the chart already atchartIndex, in place, keeping its position incharts().booleanresizeTable(String name, Range newRange) Resize the named table tonewRange(Excel's Table Design > Resize Table).booleanWhether this sheet is displayed right-to-left.doublerowHeight(int row) A row's height in points.introwOutlineLevel(int row) A row's outline level (0 = not grouped).int[]The manual horizontal page-break rows.rowStyle(int row) The style applied to the entire row — the default for cells in the row that carry no cell-level style.introwStyleId(int row) The interned style id applied to the entire row (<row s="N" customFormat="1">), or0when the row carries no row-level style.intscenarioName(int scenarioIndex) intThe first visible column of an unfrozen view; seescrollRow().intThe first visible row of an unfrozen view — the row component of<sheetView topLeftCell>(ECMA-376 Part 1 §18.3.1.87), i.e.The selected ranges of the sheet view (<selection sqref>) as a space-separated list, ornullwhen nothing was selected.voidsetActiveCell(String cell, String sqref) Moves the cursor and the selection.voidsetAutoFilter(Range range) Define an auto-filter overrange(its top row is the filter header).voidsetBackgroundImage(byte[] imageData, String format) Set the full-sheet background image.voidsetBaseColumnWidth(int width) Set thebaseColWidthbasis in characters.voidsetColumnColorFilter(int columnIndex, boolean cellColor, Color color) Filter a column by cell fill color (or font color whencellColoris false); only rows whose cell matchescolorsurvive.voidsetColumnCustomFilter(int columnIndex, FilterOperator op, String value) A single-condition custom filter on a column.voidsetColumnCustomFilter(int columnIndex, FilterOperator op1, String value1, FilterOperator op2, String value2, boolean andJoin) A two-condition custom filter;andJoin= true joins with AND, false OR.voidsetColumnDateFilter(int columnIndex, boolean includeBlank, DateGroupItem... items) A date grouping filter that optionally keeps blank cells too.voidsetColumnDateFilter(int columnIndex, DateGroupItem... items) A date grouping filter (ECMA-376 §18.3.2.4) on a column: a date cell survivesapplyAutoFilter()if it falls inside any ofitems.voidsetColumnDynamicFilter(int columnIndex, DynamicFilterType type) A dynamic filter (ECMA-376 §18.3.2.5) on a column: today / thisWeek / lastMonth / yearToDate / aboveAverage / ….voidsetColumnFilter(int columnIndex, String... values) Restrict a column (0-based, relative to the auto-filter range start) to the given values.voidsetColumnGroupCollapsed(int startCol, int endCol, boolean collapsed) Collapse or expand a grouped column range — the column analogue.voidsetColumnHidden(int col, boolean hidden) Show or hide a column.voidsetColumnsOutlineLevel(int startCol, int endCol, int level) Set the outline level0..7on columns[startCol, endCol].voidsetColumnStyle(int col, CellStyle style) Apply a style to the entire column: cells in the column without a cell-level style render with it, exactly like Excel's "format whole column".voidsetColumnTop10Filter(int columnIndex, boolean percent, double value, boolean bottom) A Top-10 filter (ECMA-376 §18.3.2.10) on a column: keep the topvalueitems — orvaluepercent of the items whenpercentis true;bottomflips to the smallest values.voidsetColumnWidth(int col, double width) Set a column's width in Excel character units.voidsetDefaultColumnWidth(double width) Set the explicit default column width in character units.voidsetDefaultRowHeight(double points) Set the default row height in points.voidsetDefaultRowHeightCustom(boolean custom) Set thecustomHeightflag on the default row height.voidsetDifferentFirst(boolean on) Set thedifferentFirstflag.voidsetDifferentOddEven(boolean on) Set thedifferentOddEvenflag.voidsetDyDescent(double dy) Set (or clear, with0) the sheet-levelx14ac:dyDescenthint.voidsetEvenFooter(String text) Set the even-page footer text;nullclears it.voidsetEvenHeader(String text) Set the even-page header text;nullclears it.voidsetFirstFooter(String text) Set the first-page footer text;nullclears it.voidsetFirstHeader(String text) Set the first-page header text;nullclears it.voidsetFirstPageNumber(int number) The number printed on the first page;0restores the workbook's own numbering (ECMA-376 §18.3.1.63firstPageNumbertogether withuseFirstPageNumber).voidSet the page footer text;nullclears it.voidSet the page header text;nullclears it.booleansetHeaderFooterPicture(String section, byte[] data, String format, double widthPt, double heightPt) Place a picture in a header/footer section (ECMA-376 §18.3.1.32legacyDrawingHF).voidsetLandscape(boolean landscape) Set landscape (true) or portrait (false) orientation.voidsetNumber(int row, int col, double value) Set a single numeric cell (0-based).voidsetPageMargins(double left, double right, double top, double bottom, double header, double footer) Set the six page margins in inches (Excel semantics, ECMA-376 §18.3.1.62 pageMargins).voidSet the page margins from aPageMarginsvalue — the symmetric counterpart ofpageMargins(), so a read–modify–write round-trip needs no unpacking into six positional arguments.voidsetPageOrderOverThenDown(boolean overThenDown) Whether pages print over-then-down instead of down-then-over (ECMA-376 §18.3.1.63pageOrder).voidsetPageScale(int scalePercent) Set the print scale percentage (disables fit-to-page).voidsetPaperSize(int paperSize) Set the paper size from its ECMA-376 numeric code (§18.18.50 ST_PaperSize): 1 = Letter, 5 = Legal, 8 = A3, 9 = A4, 11 = A5, ….booleansetPictureLinkTarget(int pictureIndex, String target) Repoints a linked picture at a new source.voidsetPrintArea(String a1Range) Set the print area (A1 range), ornullto clear it.voidsetPrintBlackAndWhite(boolean on) Print without colour (ECMA-376 §18.3.1.63blackAndWhite).voidsetPrintComments(int mode) Where cell comments print: 0 not at all, 1 as displayed on the sheet, 2 collected at the end (ECMA-376 §18.3.1.63cellComments).voidsetPrintDraft(boolean on) Print in draft quality, omitting graphics (ECMA-376 §18.3.1.63draft).voidsetPrintErrors(int mode) How error cells print: 0 as displayed, 1 blank, 2 as a dash, 3 as#N/A(ECMA-376 §18.3.1.70printOptions/errors).voidsetPrintGridlines(boolean on) Whether gridlines are printed.voidsetPrintHeadings(boolean on) Whether row and column headings are printed (ECMA-376 §18.3.1.70 printOptions/headings).voidsetPrintHorizontallyCentered(boolean centered) Center printed output horizontally on the page.voidsetPrintResolution(int dpi) The printer resolution in DPI, applied to both axes.voidsetPrintTitleColumns(String columnsRange) Columns repeated at the left of every printed page (e.g.voidsetPrintTitleRows(String rowsRange) Rows repeated at the top of every printed page (e.g.voidsetPrintVerticallyCentered(boolean centered) Center printed output vertically on the page.voidsetRightToLeft(boolean rightToLeft) Set this sheet's right-to-left display flag.voidsetRowGroupCollapsed(int startRow, int endRow, boolean collapsed) Collapse or expand a grouped row range (Excel's outline +/- button): hides/shows the detail rows and stamps thecollapsedflag on the group's summary row (below the group when the sheet summarizes below).voidsetRowHeight(int row, double points) Set a row's height in points.voidsetRowHidden(int row, boolean hidden) Show or hide a row.voidsetRowsOutlineLevel(int startRow, int endRow, int level) Set the outline level0..7on rows[startRow, endRow](0 ungroups).voidsetRowStyle(int row, CellStyle style) Apply a style to the entire row: cells in the row without a cell-level style render with it, exactly like Excel's "format whole row".booleansetScrollPosition(int row, int column) Scrolls an unfrozen view so that(row, column)sits at the top left.voidsetShapeAltText(int shapeIndex, String text) Set (or clear withnull) the shape's alternative text.voidsetShapeFillColor(int shapeIndex, Color color) Set (or clear withnull) the shape's solid fill color.voidsetShapeFlip(int shapeIndex, boolean flipHorizontal, boolean flipVertical) Set the shape's horizontal / vertical flip flags.voidsetShapeHyperlink(int shapeIndex, String url) Set (or clear withnull) the shape's hyperlink URL.voidsetShapeLineColor(int shapeIndex, Color color) Set (or clear withnull) the shape's line (outline) color.booleansetShapeName(int shapeIndex, String name) Renames a shape.voidsetShapeRotation(int shapeIndex, double degrees) Set the shape's rotation in degrees (clockwise).voidsetShapeStyleXml(int shapeIndex, String xml) Set (or clear withnull) the shape's<xdr:style>theme style-matrix reference from raw inner XML (thelnRef/fillRef/effectRef/fontRefchildren, without the enclosing<xdr:style>tags).voidsetShapeText(int shapeIndex, String text) Set (or clear withnull) the shape's text body.voidsetShowFormulas(boolean on) Turn the show-formulas display mode on or off.voidsetShowGridlines(boolean on) Show or hide the sheet view's gridlines.voidsetShowRowColHeaders(boolean on) Show or hide the sheet view's row/column headers.voidsetShowZeros(boolean on) Show zeros as0, or blank the cells that hold them.booleansetSourceSheetId(int id) Renumbers the sheet's<sheet sheetId>.booleansetSparklineStyle(int group, SparklineStyle style) Replaces the style (colors + point-highlight flags) of thegroup-th sparkline group — the styling counterpart ofaddSparkline(java.lang.String, java.lang.String, java.lang.String); read the current state back viasparklines()andSparklineGroup.style().voidsetSummaryBelow(boolean below) Sets whether row-group summaries sit below their detail rows.voidsetSummaryRight(boolean right) Sets whether column-group summaries sit right of their detail columns.voidsetTabColor(Color color) Set the sheet tab color;nullclears it.booleansetTableColumnTotals(String tableName, String columnName, TotalsRowFunction function) Set the totals-row aggregation of one column of the named table (ECMA-376 §18.18.92 ST_TotalsRowFunction).booleansetTableColumnTotals(String tableName, String columnName, TotalsRowFunction function, String label, String formula) Full form:functionmay benull(label only);labelbecomestotalsRowLabel;formulais required forTotalsRowFunction.CUSTOMand ignored otherwise.booleansetTableHeaderRow(String tableName, boolean shown) Show or hide the named table's header row (ECMA-376 §18.5.1.2headerRowCount: 1 = header present, 0 = headerless).booleansetTableStyle(String tableName, TableStyleInfo style) Replace the style binding (ECMA-376 §18.5.1.20 tableStyleInfo) of the named table; returns whether the table matched.booleansetTableTotalsRow(String tableName, boolean shown) Show or hide the named table's totals row (ECMA-376 §18.5.1.2totalsRowCount).voidsetViewType(String view) Sets the view the tab opens in.voidsetVisibility(Visibility visibility) Set this sheet's visibility.voidsetZoom(int percent) Set the sheet view zoom percentage.shapeAltText(int shapeIndex) The shape's alternative text (cNvPr/@descr), ornull.int[]shapeAnchor(int shapeIndex) {fromRow, fromCol, toRow, toCol}, or an empty array when out of range.intNumber of shapes on this sheet.shapeFillColor(int shapeIndex) The shape's solid fill color, ornull(no / non-RGB fill).boolean[]shapeFlip(int shapeIndex) {flipHorizontal, flipVertical}, or an empty array when out of range.shapeHyperlink(int shapeIndex) The hyperlink URL attached to the shape via DrawingMLhlinkClick, ornullwhen the shape has no hyperlink.shapeLineColor(int shapeIndex) The shape's line (outline) color, ornull.shapeName(int shapeIndex) The shape's drawing name (<xdr:cNvPr name>, ECMA-376 Part 1 §20.5.2.16) — what Excel shows in the Name Box and what a macro uses to address the shape.doubleshapeRotation(int shapeIndex) The shape's rotation in degrees (clockwise).shapeStyleXml(int shapeIndex) The raw inner XML of the shape's<xdr:style>theme style-matrix reference (thelnRef/fillRef/effectRef/fontRefchildren), ornullwhen the shape has no such block.shapeText(int shapeIndex) The shape's text body, ornull.shapeType(int shapeIndex) The geometry token of the shape atshapeIndex(e.g.What kind of tab this is — worksheet, chartsheet, dialog sheet or (international) Excel-4.0 macro sheet.booleanWhether the grid shows formula text instead of evaluated results (<sheetView showFormulas>).booleanWhether the sheet VIEW draws gridlines (<sheetView showGridLines>, ECMA-376 §18.3.1.87).booleanWhether the sheet VIEW draws the row/column headers (showRowColHeaders).booleanshowScenario(int scenarioIndex) Apply a scenario (writes its changing-cell values); returns whether it existed.booleanWhether a zero-valued cell shows0or shows blank (<sheetView showZeros>, ECMA-376 §18.3.1.87).intNumber of SmartArt diagrams anchored on this sheet.The SmartArt diagrams anchored on this sheet (read-only descriptors: layout family, anchor, visible node texts).voidsortByColor(Range range, int sortColumnIndex, boolean cellColor, boolean hasHeader, Color... colors) Sort the rows ofrangeby cell fill color (or font color whencellColoris false) atsortColumnIndex(0-based, relative to the range start).intThe workbook-level id this sheet arrived with (<sheet sheetId>inxl/workbook.xml), or0for a sheet created in this session — the writer allocates an id for those on save.intNumber of sparkline groups on this sheet.All sparkline groups on this sheet (ECMA-376 Part 4 §18.3.1.32,x14:sparklineGroups): the group type, basic marker/highlight style, series color and each sparkline's data range and draw location.intThe split column (0when unsplit), mirroringfreezeColumn().voidsplitPanes(int splitRow, int splitColumn) Split the view into scrollable panes at(splitRow, splitColumn)(0 = no split on that axis).intsplitRow()The split row (rows split below it;0when unsplit), mirroringfreezeRow().intsubtotal(int firstRow, int lastRow, int groupColumn, boolean hasHeaders, SubtotalFunction function, int... subtotalColumns) Insert subtotals into[firstRow, lastRow]as above.intsubtotal(int firstRow, int lastRow, int groupColumn, SubtotalFunction function, int... subtotalColumns) Insert subtotals into the sorted data block[firstRow, lastRow]: after each run of equal values ingroupColumn, a summary row offunctionoversubtotalColumnsis inserted (plus a grand total).booleanWhether a row group's summary row sits below its detail rows (<outlinePr summaryBelow>, ECMA-376 §18.3.1.61).booleanWhether a column group's summary column sits right of its detail columns (<outlinePr summaryRight>).tabColor()The tab color as a typedColor, ornullwhen the tab has no color.tables()All tables (ListObjects) on this sheet, with style and totals state.inttextToColumns(String srcRange, int destRow, int destColumn, String delimiters, boolean treatConsecutiveAsOne) Text to Columns with an explicit destination: fields of source rowiland at(destRow + i, destColumn...).inttextToColumns(String srcRange, String delimiters) Text to Columns (Excel's delimited mode) splitting in place: each text cell of the one-columnsrcRange(e.g.inttextToColumns(String srcRange, String delimiters, boolean treatConsecutiveAsOne) Text to Columns splitting in place, optionally treating a run of consecutive delimiters as one split point (Excel's "treat consecutive delimiters as one", useful for space-aligned text).voidunfreeze()Remove any frozen panes.booleanungroupShapes(int shapeIndex) Dissolve a group created bygroupShapes(java.lang.String, int...): members return to standalone emission and the group entry is removed.uniqueId()The sheet's revision GUID as stored in the source file (Excel'sxr:uidon the sheet part root), braces included — for example"{B9A12774-C2A8-4D3E-B631-D37318C68856}".voidDisable sheet protection (ignores any password).booleanDisable sheet protection after verifyingpasswordagainst the stored hash (ISO hash, or the legacy 16-bitpasswordattribute of transitional files).booleanupdateFormControl(int controlIndex, FormControl control) Replace the form control atcontrolIndex(its position informControls()) — read one, tweak it viaFormControl.toBuilder(), write it back.The used-cell bounding range, ornullif the sheet is empty.All data-validation rules on this sheet.value(int row, int col) The value of a single cell (0-based).booleanverifyProtectedRangePassword(String name, String password) Verifies the password of the allow-edit-rangename.booleanverifyProtectionPassword(String password) Whetherpasswordmatches the sheet's stored hash, leaving the protection in place either way.viewType()Which view the tab opens in (<sheetView view>, ECMA-376 §18.3.1.87):"normal","pageBreakPreview"or"pageLayout".This sheet's visibility (visible / hidden / very-hidden).intzoom()The sheet view zoom percentage (100 by default).
-
Method Details
-
name
The sheet's display name. -
index
public int index()The 0-based index of this sheet in its workbook — its position NOW. ASheetis bound to its tab, not to a position: afterWorkbook.insertSheet(int, java.lang.String),Workbook.moveSheet(int, int)or a delete of another sheet it keeps referring to the same tab.- Throws:
IllegalStateException- if this sheet has been deleted
-
visibility
This sheet's visibility (visible / hidden / very-hidden). -
setVisibility
Set this sheet's visibility.VERY_HIDDENhides it from the UI too. -
sheetType
What kind of tab this is — worksheet, chartsheet, dialog sheet or (international) Excel-4.0 macro sheet.Classification only: the engine models worksheet content, so a non-worksheet tab reads back with an empty grid, and the kind is not preserved when the workbook is saved.
-
uniqueId
The sheet's revision GUID as stored in the source file (Excel'sxr:uidon the sheet part root), braces included — for example"{B9A12774-C2A8-4D3E-B631-D37318C68856}".nullwhen the source declared none (files written before Excel 2014, and dialog sheets).Read-only: the value is not written back on save.
-
rightToLeft
public boolean rightToLeft()Whether this sheet is displayed right-to-left. -
setRightToLeft
public void setRightToLeft(boolean rightToLeft) Set this sheet's right-to-left display flag. -
tabColor
The tab color as a typedColor, ornullwhen the tab has no color. RGB, theme (with tint), and legacy indexed tab colors are all surfaced — inspect the kind withColor.isTheme()etc. -
setTabColor
Set the sheet tab color;nullclears it. RGB, theme, and indexed colors are all accepted (anColor.auto()color clears it, since a tab has no automatic color). -
header
The page header text (Excel codes like&C,&Pallowed), ornull. -
setHeader
Set the page header text;nullclears it. -
firstHeader
The first-page header text, ornull(only used whendifferentFirst()). -
setFirstHeader
Set the first-page header text;nullclears it. -
differentFirst
public boolean differentFirst()Whether the first printed page uses its own header/footer (ECMA-376 §18.3.1.46differentFirst). Whentrue, the odd/default header/footer is suppressed on page 1 in favor of the first-page variant — e.g. no page number on a cover page. -
setDifferentFirst
public void setDifferentFirst(boolean on) Set thedifferentFirstflag. -
evenHeader
The even-page header text, ornull(only used whendifferentOddEven()). -
setEvenHeader
Set the even-page header text;nullclears it. -
differentOddEven
public boolean differentOddEven()Whether odd and even printed pages use distinct headers/footers (ECMA-376 §18.3.1.46differentOddEven). Whentrue, the even-page variant prints on pages 2, 4, 6, … and the odd/default variant on pages 1, 3, 5, … — e.g. mirrored margins in a bound document. -
setDifferentOddEven
public void setDifferentOddEven(boolean on) Set thedifferentOddEvenflag. -
range
A range over the inclusive rectangle(r1,c1)..(r2,c2), 0-based. -
range
A range parsed from A1 notation, e.g."A1"or"A1:C10". -
cell
A single-cell view at(row, col)(0-based). -
value
The value of a single cell (0-based). Convenience — one JNI crossing; userange(int, int, int, int)for bulk work. -
setNumber
public void setNumber(int row, int col, double value) Set a single numeric cell (0-based). The value only: the cell keeps its style, comment and hyperlink, as withCell.setValue. One JNI crossing. -
importData
Import a collection of Java objects into a range. Each element becomes one row starting at(startRow, startCol); the object's properties become columns. Properties are discovered by reflection — Java records first (component order), else JavaBean getters (getX/isX, ordered by property name), else public instance fields (declared order). An element that is aMapis a row keyed by column name: its keys become the columns, in the order they are first met across the rows (passImportOptions.columnsor use aLinkedHashMapfor a fixed order), and a missing key leaves its cell blank. Values map toCellValue: numbers stay numeric,Booleanto bool,CharSequenceto text,LocalDate/LocalDateTime/Dateto Excel date serials,nullto blank, anything else to itstoString().Rows are written through the bulk
Range.setValues(io.keikai.axyra.sheets.CellValue[][])path in chunks (one JNI crossing per chunk).- Parameters:
items- the objects to import; must all be the same class as the first element, or all be mapsoptions- column selection, header, labels, and header style; whennull,ImportOptions.defaults()apply- Returns:
- the number of rows written, including the header row when enabled
- Throws:
AxyraException- ifitemsis null, the elements are of mixed types, an element is a plain value (a string, number, date, collection or array) rather than a row, or anoptions.columns()name is unknown
-
importData
Import a collection with default options (header row on, all properties). -
insertRows
public void insertRows(int startRow, int count) Insertcountblank rows beforestartRow. -
deleteRows
public void deleteRows(int startRow, int count) Deletecountrows starting atstartRow. -
insertColumns
public void insertColumns(int startCol, int count) Insertcountblank columns beforestartCol. -
deleteColumns
public void deleteColumns(int startCol, int count) Deletecountcolumns starting atstartCol. -
setRowHeight
public void setRowHeight(int row, double points) Set a row's height in points. -
rowHeight
public double rowHeight(int row) A row's height in points. -
isRowHeightCustom
public boolean isRowHeightCustom(int row) Whether the row's height was explicitly authored (viasetRowHeight(int, double)or a<row ht>in the source file). This distinction matters to Excel: a row without an explicit height auto-fits to its content font when the file opens, while an explicit height stays fixed — even when its value equalsdefaultRowHeight(). -
setColumnWidth
public void setColumnWidth(int col, double width) Set a column's width in Excel character units. -
columnWidth
public double columnWidth(int col) A column's width in character units. -
defaultRowHeight
public double defaultRowHeight()The sheet's default row height in points — the height of every row without an explicitsetRowHeight(int, double)override.15for a freshly created sheet;0when a loaded sheet declares no default at all (Excel then uses its font-derived default). -
setDefaultRowHeight
public void setDefaultRowHeight(double points) Set the default row height in points. Pass0to clear the declaration so the saved sheet carries no explicit default. -
isDefaultRowHeightCustom
public boolean isDefaultRowHeightCustom()Whether the default row height is flagged as an explicit, honoured value (thesheetFormatPr customHeightflag). -
setDefaultRowHeightCustom
public void setDefaultRowHeightCustom(boolean custom) Set thecustomHeightflag on the default row height. -
defaultColumnWidth
public double defaultColumnWidth()The sheet's explicit default column width in character units, or0when none is declared — column widths then derive frombaseColumnWidth(). A freshly created sheet reports Excel's stock8.43.columnWidth(int)on an untouched column always returns the effective width, whichever way it is declared. -
setDefaultColumnWidth
public void setDefaultColumnWidth(double width) Set the explicit default column width in character units. Pass0to clear the declaration (widths then fall back to thebaseColWidthbasis). -
baseColumnWidth
public int baseColumnWidth()The declaredbaseColWidthbasis in characters, or0when the sheet does not declare one (the spec default of 8 applies). -
setBaseColumnWidth
public void setBaseColumnWidth(int width) Set thebaseColWidthbasis in characters. Pass0to clear the declaration. -
formattedColumns
public int[] formattedColumns()The 0-based indexes (ascending) of columns carrying explicit column-level metadata — width, hidden flag, column style or outline. Columns using pure defaults are not listed; a fresh sheet returns an empty array. -
formattedRows
public int[] formattedRows()0-based indexes of the rows carrying explicit row-level metadata — a custom height, a hidden flag, or a row style — the row analogue offormattedColumns(). A row with an authored height but no cells (e.g. a top spacer row) is listed here even though a used-cell-rectangle sweep would miss it. Rows using pure defaults are not listed. -
isColumnWidthCustom
public boolean isColumnWidthCustom(int col) Whether the column's width was explicitly authored (viasetColumnWidth(int, double)or a<col width>in the source file), as opposed to inheriting the sheet default. -
columnStyleId
public int columnStyleId(int col) The column-level style id (an engine-internal dedup index, matchingRange.styleIds()), or0when the column carries no column-level style. -
columnStyle
The style applied to the entire column — the default for cells in the column that carry no cell-level style (<col style>). Returnsnullwhen the column has none. -
setColumnStyle
Apply a style to the entire column: cells in the column without a cell-level style render with it, exactly like Excel's "format whole column". Passnullto clear. -
rowStyleId
public int rowStyleId(int row) The interned style id applied to the entire row (<row s="N" customFormat="1">), or0when the row carries no row-level style. The row analogue ofcolumnStyleId(int). -
rowStyle
The style applied to the entire row — the default for cells in the row that carry no cell-level style. Returnsnullwhen the row has none. -
setRowStyle
Apply a style to the entire row: cells in the row without a cell-level style render with it, exactly like Excel's "format whole row". Passnullto clear. -
showGridlines
public boolean showGridlines()Whether the sheet VIEW draws gridlines (<sheetView showGridLines>, ECMA-376 §18.3.1.87). Distinct fromprintGridlines(), which controls printing — dashboards commonly hide the on-screen gridlines while never printing them. -
setShowGridlines
public void setShowGridlines(boolean on) Show or hide the sheet view's gridlines. -
showRowColHeaders
public boolean showRowColHeaders()Whether the sheet VIEW draws the row/column headers (showRowColHeaders). -
setShowRowColHeaders
public void setShowRowColHeaders(boolean on) Show or hide the sheet view's row/column headers. -
showZeros
public boolean showZeros()Whether a zero-valued cell shows0or shows blank (<sheetView showZeros>, ECMA-376 §18.3.1.87). The attribute's default istrue, which is what a sheet that never declared one reports. -
setShowZeros
public void setShowZeros(boolean on) Show zeros as0, or blank the cells that hold them. -
showFormulas
public boolean showFormulas()Whether the grid shows formula text instead of evaluated results (<sheetView showFormulas>). A display mode only — the stored values are untouched, so nothing recalculates when it changes. -
setShowFormulas
public void setShowFormulas(boolean on) Turn the show-formulas display mode on or off. -
viewType
Which view the tab opens in (<sheetView view>, ECMA-376 §18.3.1.87):"normal","pageBreakPreview"or"pageLayout". A sheet with no such attribute reports"normal", the value the spec assigns it. -
setViewType
Sets the view the tab opens in."normal"clears the attribute rather than writing it, so a sheet that never had one does not gain aview="normal"it did not carry before. -
summaryBelow
public boolean summaryBelow()Whether a row group's summary row sits below its detail rows (<outlinePr summaryBelow>, ECMA-376 §18.3.1.61).trueis the default. Grouping reads the flag when it places a summary, so flipping it changes where later groups collapse to. -
setSummaryBelow
public void setSummaryBelow(boolean below) Sets whether row-group summaries sit below their detail rows. -
summaryRight
public boolean summaryRight()Whether a column group's summary column sits right of its detail columns (<outlinePr summaryRight>).trueis the default. -
setSummaryRight
public void setSummaryRight(boolean right) Sets whether column-group summaries sit right of their detail columns. -
activeCell
The sheet view's active cell as an A1 reference (<sheetView><selection activeCell>, ECMA-376 §18.3.1.78), ornullwhen the sheet carries no selection at all. -
selectionSqref
The selected ranges of the sheet view (<selection sqref>) as a space-separated list, ornullwhen nothing was selected. -
setActiveCell
Moves the cursor and the selection.sqrefmay name several space-separated ranges;nullselects the active cell alone.Any per-pane selection list captured on import is dropped, because it records the old cursor — keeping it would make the saved file reopen at the previous position and silently discard this call.
-
sourceSheetId
public int sourceSheetId()The workbook-level id this sheet arrived with (<sheet sheetId>inxl/workbook.xml), or0for a sheet created in this session — the writer allocates an id for those on save.Pivot caches, defined names and external links address a sheet by this id rather than by tab position, so it is not
index(). -
setSourceSheetId
public boolean setSourceSheetId(int id) Renumbers the sheet's<sheet sheetId>.Returns
falsefor0— which the writer reads as "unset" and would replace with an allocated id — and for an id another sheet already holds, since sheet ids are unique within a workbook and a duplicate makes the package invalid rather than merely wrong. -
scrollRow
public int scrollRow()The first visible row of an unfrozen view — the row component of<sheetView topLeftCell>(ECMA-376 Part 1 §18.3.1.87), i.e. where the window is scrolled to. 0 when unscrolled.A sheet with frozen panes uses the same attribute to anchor the frozen corner instead, and reports 0 here; read
freezeRow()/freezeColumn()for that sheet. -
scrollColumn
public int scrollColumn()The first visible column of an unfrozen view; seescrollRow(). -
setScrollPosition
public boolean setScrollPosition(int row, int column) Scrolls an unfrozen view so that(row, column)sits at the top left.Returns
falsefor a sheet with frozen panes: there the attribute belongs to the frozen corner, so writing a scroll position into it would move the freeze rather than the window. -
hasPageSetup
public boolean hasPageSetup()Whether the sheet carries a<pageSetup>element (ECMA-376 §18.3.1.63). Presence changes real Excel's print layout both ways — a spurious element flips the default paper to Letter, a missing one shifts the printed body up — so a faithful rebuild reproduces it exactly. Any page-setup setter (orientation, scale, fit-to-page, paper size) marks the element present. -
dyDescent
public double dyDescent()The sheet-levelx14ac:dyDescenttext-descent hint on<sheetFormatPr>, or0when absent. Excel caches the default font's descent here and uses it when computing the rendered height of height-less rows; a rebuilt sheet that drops the hint can fit a different number of rows per printed page, drifting every page break of a long table. -
setDyDescent
public void setDyDescent(double dy) Set (or clear, with0) the sheet-levelx14ac:dyDescenthint. -
setRowHidden
public void setRowHidden(int row, boolean hidden) Show or hide a row. -
isRowHidden
public boolean isRowHidden(int row) -
setColumnHidden
public void setColumnHidden(int col, boolean hidden) Show or hide a column. -
isColumnHidden
public boolean isColumnHidden(int col) -
freezePanes
public void freezePanes(int freezeRow, int freezeCol) Freeze rows abovefreezeRowand columns left offreezeCol. -
unfreeze
public void unfreeze()Remove any frozen panes. -
freezeRow
public int freezeRow()The frozen row split (rows above are frozen); 0 if none. -
freezeColumn
public int freezeColumn()The frozen column split (columns left are frozen); 0 if none. -
splitPanes
public void splitPanes(int splitRow, int splitColumn) Split the view into scrollable panes at(splitRow, splitColumn)(0 = no split on that axis). Unlike a freeze, both panes scroll. -
splitRow
public int splitRow()The split row (rows split below it;0when unsplit), mirroringfreezeRow(). -
splitColumn
public int splitColumn()The split column (0when unsplit), mirroringfreezeColumn(). -
addRowPageBreak
public void addRowPageBreak(int row) Insert a manual page break beforerow(horizontal break). -
addColumnPageBreak
public void addColumnPageBreak(int column) Insert a manual page break beforecolumn(vertical break). -
rowPageBreaks
public int[] rowPageBreaks()The manual horizontal page-break rows. -
columnPageBreaks
public int[] columnPageBreaks()The manual vertical page-break columns. -
clearPageBreaks
public void clearPageBreaks()Remove all manual page breaks. -
mergedRegions
The merged-cell regions on this sheet. -
usedRange
The used-cell bounding range, ornullif the sheet is empty. -
find
Find all cells whose text matches, as{row, col}pairs. Sheet-wide. -
find
Find with options. Sheet-wide. -
findRegex
Find all cells whose text matches the regular expressionpattern(case-insensitive), as{row, col}pairs. Sheet-wide. An invalid pattern falls back to plain-text matching. -
findRegex
findRegex(String)with explicit case sensitivity. -
find
Find restricted to cells whose resolved style matchesformat(Excel's search-by-format) — seeFindFormatfor the matching semantics. An emptytextwith a non-empty format is a format-only find: it returns every cell carrying the format regardless of value type. Sheet-wide. -
find
public int[][] find(String text, boolean caseSensitive, boolean matchEntire, boolean wildcard, FindFormat format) find(String, FindFormat)with the full option set. Sheet-wide. -
replaceAll
Replace text in all matching cells; returns the number replaced. Sheet-wide. -
replaceAll
public int replaceAll(String find, String replace, boolean caseSensitive, boolean matchEntire, boolean wildcard) Replace with options. Sheet-wide. -
replaceAllRegex
Replace every match of the regular expressionpattern(case-insensitive) withreplacement, which may reference capture groups ("$1","${name}"). Returns the number of cells changed. Sheet-wide. -
replaceAllRegex
replaceAllRegex(String, String)with explicit case sensitivity. -
replaceAll
Replace restricted to cells whose resolved style matchesformat— seeFindFormatfor the matching semantics. An emptyfindtext replaces nothing. Returns the number replaced. Sheet-wide. -
replaceAll
public int replaceAll(String find, String replace, boolean caseSensitive, boolean matchEntire, boolean wildcard, FindFormat format) replaceAll(String, String, FindFormat)with the full option set. -
textToColumns
Text to Columns (Excel's delimited mode) splitting in place: each text cell of the one-columnsrcRange(e.g."A1:A10") is split on thedelimiterscharacters and the fields spread rightward from the source column, overwriting existing cells without prompting. Returns the widest row's output column count.- Parameters:
delimiters- the set of split characters, e.g.","or";\t"— tab, semicolon, comma, and space plus at most one custom character
-
textToColumns
Text to Columns splitting in place, optionally treating a run of consecutive delimiters as one split point (Excel's "treat consecutive delimiters as one", useful for space-aligned text). -
textToColumns
public int textToColumns(String srcRange, int destRow, int destColumn, String delimiters, boolean treatConsecutiveAsOne) Text to Columns with an explicit destination: fields of source rowiland at(destRow + i, destColumn...). The source range must be exactly one column wide (as in Excel). -
validations
All data-validation rules on this sheet. -
clearValidations
public void clearValidations()Remove all data-validation rules from this sheet. -
removeValidation
public boolean removeValidation(int validationIndex) Remove the data-validation rule atvalidationIndex(its position invalidations()); returns whether it existed. -
conditionalFormats
All conditional-formatting rules on this sheet. -
clearConditionalFormats
public void clearConditionalFormats()Remove all conditional-formatting rules from this sheet. -
removeConditionalFormat
public boolean removeConditionalFormat(int formatIndex) Remove the conditional-formatting rule atformatIndex(its position inconditionalFormats()); returns whether it existed. -
tables
All tables (ListObjects) on this sheet, with style and totals state. -
removeTable
Remove the table with the given name; returns whether any matched. -
convertTableToRange
Convert the named table back to an ordinary range (Excel's Table Design > Convert to Range): drops the table definition while keeping every cell value in place. Returns whether the table matched. This is the inverse ofRange.createTable(String, String...). -
resizeTable
Resize the named table tonewRange(Excel's Table Design > Resize Table). The header row must stay where it is, and at least one data row must remain. Columns are remapped by sheet position: kept positions keep their column definitions (totals, formulas); new positions take the header-cell text when present, else a generated uniqueColumnNname. Returns whether the resize applied. -
autoExpandTables
Apply Excel's type-adjacent table auto-expansion for a data entry at (row,col): typing one row below a table's last data row (inside its column span, no totals row) grows it by one row; typing in the header row one column right of its last column grows it by one column namedtypedText— unless another table occupies the candidate column. Only table metadata is adjusted; write the cell value separately. Returns whether any table expanded. -
smartArtCount
public int smartArtCount()Number of SmartArt diagrams anchored on this sheet. -
smartArts
The SmartArt diagrams anchored on this sheet (read-only descriptors: layout family, anchor, visible node texts). Imported diagrams render in PDF/image output and round-trip on save; authoring is not supported. -
setTableStyle
Replace the style binding (ECMA-376 §18.5.1.20 tableStyleInfo) of the named table; returns whether the table matched. The table part is regenerated on the next save. -
setTableTotalsRow
Show or hide the named table's totals row (ECMA-376 §18.5.1.2totalsRowCount). Showing extends the table range one row down and materializes the configured per-column totals cells (SUBTOTAL formulas / labels), like Excel; hiding shrinks the range back. Returns whether the table matched. -
setTableHeaderRow
Show or hide the named table's header row (ECMA-376 §18.5.1.2headerRowCount: 1 = header present, 0 = headerless). Unlike the totals row, this does NOT resize the table range — the first row of the range is simply re-interpreted as header (shown) or first data row (hidden). AcreateTablealways makes a header-row table, so passfalsehere to reproduce a headerless source table; otherwise Excel treats the first data row as the header and may refuse to open the file. Returns whether the table matched. -
setTableColumnTotals
public boolean setTableColumnTotals(String tableName, String columnName, TotalsRowFunction function) Set the totals-row aggregation of one column of the named table (ECMA-376 §18.18.92 ST_TotalsRowFunction). Built-in functions becomeSUBTOTAL(101..110, Table[Column])cells when the totals row is shown. UsesetTableColumnTotals(String, String, TotalsRowFunction, String, String)forCUSTOM(needs a formula) or a label. Returns whether the table and column matched. -
setTableColumnTotals
public boolean setTableColumnTotals(String tableName, String columnName, TotalsRowFunction function, String label, String formula) Full form:functionmay benull(label only);labelbecomestotalsRowLabel;formulais required forTotalsRowFunction.CUSTOMand ignored otherwise. -
addChart
Add a chart to this sheet; returns the new chart's index. -
addPivotChart
public int addPivotChart(int pivotIndex, String chartType, int fromRow, int fromCol, int toRow, int toCol) Add a PivotChart bound to the pivot table atpivotIndexon this sheet, anchored over the given cell rectangle. The pivot must have been refreshed first so its output range is known; the chart's series are derived from that output (one series per data column, categories from the row-label column, grand totals excluded) and the chart carries Excel'spivotSourcebinding (ECMA-376 §21.2.2.153) so it stays linked to the pivot on open.- Parameters:
pivotIndex- the pivot table's index on this sheetchartType- a chart type token accepted byChart.of(java.lang.String)(e.g."column","bar","pie")- Returns:
- the new chart's index on this sheet, or
-1when the pivot does not exist or has not been refreshed
-
charts
All charts on this sheet. -
chart
A live view of the chart atchartIndex(its position incharts()), with read-back getters and setters that apply immediately. ThrowsAxyraExceptionwhen out of range. -
replaceChart
Applychart's spec onto the chart already atchartIndex, in place, keeping its position incharts().The engine overlays the spec rather than swapping the chart out, so detail the spec does not carry survives — per-series trendlines, error bars and data labels when the matching series is silent about them, plus the parts of an imported chart the spec has no field for (3-D view angles, manual layouts, an Excel-2016 extended chart's preserved apparatus, a PivotChart binding). Marks the sheet's drawing dirty, so the saved package carries the edit.
This is the read–modify–write counterpart of
addChart(io.keikai.axyra.sheets.content.Chart): read withcharts(), edit throughChart.toBuilder(), write back here. Editing one field at a time throughchart(int)does the same thing one round trip at a time. -
clearCharts
public void clearCharts()Remove all charts from this sheet. -
removeChart
public boolean removeChart(int chartIndex) Remove the chart atchartIndex(its position incharts()); returns whether it existed. -
addCheckbox
public int addCheckbox(String name, int fromRow, int fromColumn, int toRow, int toColumn, String linkedCell) Add a checkbox form control anchored to a two-cell rectangle, optionally bound to a linked cell (A1 ref) reflecting its state. Convenience foraddFormControl(FormControl)with aFormControl.checkBox(String)spec. -
formControlCount
public int formControlCount() -
addFormControl
Add a form control (check box, option button, button, combo box, list box, scroll bar, spin button, edit box, label, group box); returns its index informControls(). The control's parts (control properties, legacy drawing shape and worksheet registration) are generated on save. -
formControls
All form controls on this sheet, in z-order. -
updateFormControl
Replace the form control atcontrolIndex(its position informControls()) — read one, tweak it viaFormControl.toBuilder(), write it back. Returns whether it existed. -
removeFormControl
public boolean removeFormControl(int controlIndex) Remove the form control atcontrolIndex(its position informControls()); returns whether it existed. -
addPivotTable
Create a pivot table atlocation(A1 anchor) over a source range; returns its index. Its output is built byPivotTableView.refresh()— and, for a pivot created or changed through the API and not refreshed since, automatically before the workbook is saved or rendered. -
pivotCount
public int pivotCount() -
pivotName
-
pivotLocation
The destination location (e.g."H1") of the pivot table atpivotIndex. -
pivotSource
The source data reference of the pivot table atpivotIndex. -
pivotTable
A live view of the pivot table atpivotIndex: field areas (row / column / filter / values), aggregation functions, layout, grand totals, andPivotTableView.refresh().- Throws:
AxyraException- whenpivotIndexis out of range
-
pivotTable
A live view of the pivot table namedname(exact match first, then case-insensitive).- Throws:
AxyraException- when no pivot table has that name
-
addScenario
Add a what-if scenario; returns its index. -
scenarioCount
public int scenarioCount() -
scenarioName
-
showScenario
public boolean showScenario(int scenarioIndex) Apply a scenario (writes its changing-cell values); returns whether it existed. -
addPicture
public int addPicture(byte[] imageData, String format, int fromRow, int fromColumn, int toRow, int toColumn) Insert an image anchored to a two-cell rectangle (0-based cells).formatis png/jpeg/gif/bmp/tiff/emf/wmf/svg/webp. -
addPicture
public int addPicture(byte[] imageData, String format, int fromRow, int fromColumn, int fromRowOffset, int fromColumnOffset, int toRow, int toColumn, int toRowOffset, int toColumnOffset) Insert an image with a full two-cell anchor including EMU offsets. The offsets carry a sub-cell size that a plain cell rectangle cannot express (e.g. a one-cell-anchored image whose size lives in theto*Offsetfields). UsepictureAnchorFull(int)to read them back. -
pictureCount
public int pictureCount()Number of pictures on this sheet. -
addLinkedPicture
Add a linked picture over the rectangle(r1,c1)..(r2,c2): the image is referenced by an externaltarget(URL or path) via<a:blip r:link>instead of embedding bytes (ECMA-376 Part 1 §20.1.8.13). Returns the picture index. UseaddPicture(byte[], java.lang.String, int, int, int, int)for the usual embedded case. -
pictureLinkTarget
The external link target of the picture atpictureIndex, ornullwhen it is an ordinary embedded picture. -
setPictureLinkTarget
Repoints a linked picture at a new source.Returns
falsefor an embedded picture: its bytes live in the package, so giving it a link would leave the file carrying both the image and a reference to another one. UseaddLinkedPicture(String, String, int, int, int, int)to add a linked picture in the first place. -
anchorOleObject
public boolean anchorOleObject(int objectIndex, byte[] iconBytes, String iconFormat, int fromRow, int fromCol, int toRow, int toCol) Display the workbook-level embedded OLE object atobjectIndex(seeWorkbook.addOleObject(java.lang.String, java.lang.String, byte[])) as an icon on this sheet, anchored over the cell rectangle(fromRow, fromCol)–(toRow, toCol)(0-based, exclusive bottom-right edge like a drawing anchor).iconBytesis the image shown on the sheet (iconFormat:"png","jpeg","gif","bmp","tiff","emf","wmf"); double-clicking the icon in Excel opens the embedded content.Returns whether the anchor was added —
falsewhen the object index does not exist, the icon bytes are empty, or this sheet already carries OLE anchors imported from an opened XLSX (merging authored icons into an imported legacy drawing is not supported). -
pictureData
public byte[] pictureData(int pictureIndex) The raw image bytes of the picture atpictureIndex, ornull. -
pictureFormat
The format token (png/jpeg/…) of the picture atpictureIndex, ornull. -
pictureAnchor
public int[] pictureAnchor(int pictureIndex) {fromRow, fromCol, toRow, toCol}anchor of the picture, or an empty array. -
pictureAnchorFull
public int[] pictureAnchorFull(int pictureIndex) {fromRow, fromCol, fromRowOffset, fromColOffset, toRow, toCol, toRowOffset, toColOffset}anchor of the picture (EMU offsets included), or an empty array. Pass these eight values to the 10-argaddPicture(byte[], java.lang.String, int, int, int, int)overload to reproduce the image faithfully. -
clearPictures
public void clearPictures()Remove all pictures from this sheet. -
removePicture
public boolean removePicture(int pictureIndex) Remove the picture atpictureIndex(0-based, the same index used bypictureData(int)); returns whether it existed. -
setBackgroundImage
Set the full-sheet background image. Excel tiles the image behind the cells on screen; it is never printed.formatis png/jpeg/gif/bmp/tiff/emf/wmf/svg/webp. Replaces any existing background. -
backgroundImage
public byte[] backgroundImage()The raw bytes of the sheet background image, ornullwhen none. -
backgroundImageFormat
The format token (png/jpeg/…) of the sheet background image, ornullwhen none. -
clearBackgroundImage
public boolean clearBackgroundImage()Remove the sheet background image; returns whether one existed. -
setLandscape
public void setLandscape(boolean landscape) Set landscape (true) or portrait (false) orientation. -
isLandscape
public boolean isLandscape() -
setPrintArea
Set the print area (A1 range), ornullto clear it. -
printArea
-
setPrintTitleRows
Rows repeated at the top of every printed page (e.g."$1:$2"); null clears. -
printTitleRows
-
setPrintTitleColumns
Columns repeated at the left of every printed page (e.g."$A:$A"); null clears. -
printTitleColumns
-
setPrintGridlines
public void setPrintGridlines(boolean on) Whether gridlines are printed. -
printGridlines
public boolean printGridlines()Whether gridlines are printed (ECMA-376 §18.3.1.65 printOptions/gridLines). -
setPrintHeadings
public void setPrintHeadings(boolean on) Whether row and column headings are printed (ECMA-376 §18.3.1.70 printOptions/headings). Controls the printout only — distinct from the on-screen heading visibility toggle. -
setPageOrderOverThenDown
public void setPageOrderOverThenDown(boolean overThenDown) Whether pages print over-then-down instead of down-then-over (ECMA-376 §18.3.1.63pageOrder). -
pageOrderOverThenDown
public boolean pageOrderOverThenDown()Whether pages print over-then-down. -
setPrintBlackAndWhite
public void setPrintBlackAndWhite(boolean on) Print without colour (ECMA-376 §18.3.1.63blackAndWhite). -
printBlackAndWhite
public boolean printBlackAndWhite()Whether the sheet prints without colour. -
setPrintDraft
public void setPrintDraft(boolean on) Print in draft quality, omitting graphics (ECMA-376 §18.3.1.63draft). -
printDraft
public boolean printDraft()Whether the sheet prints in draft quality. -
setPrintErrors
public void setPrintErrors(int mode) How error cells print: 0 as displayed, 1 blank, 2 as a dash, 3 as#N/A(ECMA-376 §18.3.1.70printOptions/errors). -
printErrors
public int printErrors()How error cells print, as the same codesetPrintErrors(int)takes. -
setFirstPageNumber
public void setFirstPageNumber(int number) The number printed on the first page;0restores the workbook's own numbering (ECMA-376 §18.3.1.63firstPageNumbertogether withuseFirstPageNumber). -
firstPageNumber
public int firstPageNumber()The number printed on the first page, or0when unset. -
setPrintComments
public void setPrintComments(int mode) Where cell comments print: 0 not at all, 1 as displayed on the sheet, 2 collected at the end (ECMA-376 §18.3.1.63cellComments). -
printComments
public int printComments()Where cell comments print, as the same codesetPrintComments(int)takes. -
setPrintResolution
public void setPrintResolution(int dpi) The printer resolution in DPI, applied to both axes. -
printResolution
public int printResolution()The printer resolution in DPI. -
printHeadings
public boolean printHeadings()Whether row and column headings are printed. -
fitToPage
public void fitToPage(int width, int height) Fit the printout towidthpages wide byheighttall. -
isFitToPage
public boolean isFitToPage()Whether fit-to-page scaling is active (set byfitToPage(int, int)); whenfalsethe sheet prints atpageScale(). The flag lives in ECMA-376 §18.3.1.70<pageSetUpPr fitToPage="1"/>. -
fitToWidth
public int fitToWidth()Pages wide the printout is fitted to (0= automatic / unlimited); only meaningful whenisFitToPage(). ECMA-376 §18.3.1.63 fitToWidth. -
fitToHeight
public int fitToHeight()Pages tall the printout is fitted to (0= automatic / unlimited); only meaningful whenisFitToPage(). ECMA-376 §18.3.1.63 fitToHeight. -
setPageScale
public void setPageScale(int scalePercent) Set the print scale percentage (disables fit-to-page). -
pageScale
public int pageScale()The print scale percentage (100 = no scaling). -
setPaperSize
public void setPaperSize(int paperSize) Set the paper size from its ECMA-376 numeric code (§18.18.50 ST_PaperSize): 1 = Letter, 5 = Legal, 8 = A3, 9 = A4, 11 = A5, …. Codes below 1 throwAxyraException. -
paperSize
public int paperSize()The paper size as its ECMA-376 numeric code (9 = A4 by default). -
isPaperSizeDeclared
public boolean isPaperSizeDeclared()Whether this sheet explicitly declares a paper size. A loaded sheet whose source<pageSetup>carried nopaperSizereportsfalse— Excel then prints it on the printer's default paper, whateverpaperSize()reports as the engine fallback. -
clearPaperSize
public void clearPaperSize()Remove the explicit paper-size declaration, so the saved sheet omits thepaperSizeattribute and consumers use their printer default. Undone by the nextsetPaperSize(int). -
printHorizontallyCentered
public boolean printHorizontallyCentered()Whether printed output is centered horizontally on the page (<printOptions horizontalCentered>, ECMA-376 §18.3.1.70). -
setPrintHorizontallyCentered
public void setPrintHorizontallyCentered(boolean centered) Center printed output horizontally on the page. -
printVerticallyCentered
public boolean printVerticallyCentered()Whether printed output is centered vertically on the page (<printOptions verticalCentered>, ECMA-376 §18.3.1.70). -
setPrintVerticallyCentered
public void setPrintVerticallyCentered(boolean centered) Center printed output vertically on the page. -
setPageMargins
public void setPageMargins(double left, double right, double top, double bottom, double header, double footer) Set the six page margins in inches (Excel semantics, ECMA-376 §18.3.1.62 pageMargins). Negative values throwAxyraException. -
setPageMargins
Set the page margins from aPageMarginsvalue — the symmetric counterpart ofpageMargins(), so a read–modify–write round-trip needs no unpacking into six positional arguments. -
pageMargins
The page margins in inches. -
setZoom
public void setZoom(int percent) Set the sheet view zoom percentage. Excel's valid range is 10–400; anything else throwsAxyraException. (The zoom applies to the on-screen view, not printing — usesetPageScale(int)for print scaling.) -
zoom
public int zoom()The sheet view zoom percentage (100 by default). -
protect
public void protect()Enable sheet protection (Excel-default allowances). -
protect
Enable sheet protection with a password (ISO Write Protection hash, SHA-512 + 100,000 spins per [MS-OFFCRYPTO] §2.4.2.2) and Excel's default allowances.nullor empty protects without a password. -
protect
Enable sheet protection with explicit ECMA-376 §18.3.1.85 options and an optional password (null= none). -
unprotect
public void unprotect()Disable sheet protection (ignores any password). -
unprotect
Disable sheet protection after verifyingpasswordagainst the stored hash (ISO hash, or the legacy 16-bitpasswordattribute of transitional files). Returnstruewhen the sheet ends up unprotected — including when it was not protected or carries no password; returnsfalse(sheet stays protected) on a mismatch. -
isProtected
public boolean isProtected()Whether this sheet is protected. -
isProtectedWithPassword
public boolean isProtectedWithPassword()Whether the sheet's protection carries a password.Read-only: unlike
unprotect(String)this leaves the sheet protected, so a caller can decide whether to prompt without changing the workbook to find out. -
verifyProtectionPassword
Whetherpasswordmatches the sheet's stored hash, leaving the protection in place either way.Answers
truewhenever there is no hash to disagree with — both for a sheet protected without a password and for a sheet that is not protected at all. Read as "supplying this password would let you through", which is what a caller gating anunprotect()on it needs; do NOT read it as "this sheet has that password". The two cases are told apart byisProtectedWithPassword(), which isfalsefor both of them. -
protection
The protection options (allow semantics), ornullwhen this sheet is not protected. -
addProtectedRange
Adds an allow-users-to-edit-range (protectedRange— ECMA-376 Part 1 §18.3.1.72): the named rangesqrefstays editable while the sheet is protected. Pass apasswordto gate it (stored as an ISO Write Protection hash), ornullfor an ungated range. Re-adding a range with the same name replaces it.- Throws:
AxyraException- when the name or sqref is empty
-
addProtectedRange
Adds an ungated allow-edit-range. -
removeProtectedRange
Removes the allow-edit-rangename; returns whether it existed. -
protectedRanges
The sheet's allow-edit-ranges, in definition order. -
verifyProtectedRangePassword
Verifies the password of the allow-edit-rangename. -
setAutoFilter
Define an auto-filter overrange(its top row is the filter header). The filter is modeled and round-trips to XLSX; note the engine does not itself execute criteria-based row hiding. -
autoFilterRange
The filtered block, ornullwhen this sheet has no autofilter.Read counterpart of
setAutoFilter(Range): a caller that did not set the filter itself (an imported workbook, for example) needs to know which block the dropdowns cover. -
hasAutoFilter
public boolean hasAutoFilter() -
clearAutoFilter
public void clearAutoFilter()Remove any auto-filter. -
setColumnFilter
Restrict a column (0-based, relative to the auto-filter range start) to the given values. Takes effect at once, as in Excel: rows that fail are hidden. EverysetColumn*FilterandclearColumnFilter(int)re-runs the filter this way. -
setColumnCustomFilter
A single-condition custom filter on a column. -
setColumnCustomFilter
public void setColumnCustomFilter(int columnIndex, FilterOperator op1, String value1, FilterOperator op2, String value2, boolean andJoin) A two-condition custom filter;andJoin= true joins with AND, false OR. -
setColumnColorFilter
Filter a column by cell fill color (or font color whencellColoris false); only rows whose cell matchescolorsurvive. -
setColumnTop10Filter
public void setColumnTop10Filter(int columnIndex, boolean percent, double value, boolean bottom) A Top-10 filter (ECMA-376 §18.3.2.10) on a column: keep the topvalueitems — orvaluepercent of the items whenpercentis true;bottomflips to the smallest values. The threshold is computed from the column data onapplyAutoFilter()(non-numeric cells are hidden); ties at the threshold survive. -
setColumnDynamicFilter
A dynamic filter (ECMA-376 §18.3.2.5) on a column: today / thisWeek / lastMonth / yearToDate / aboveAverage / …. Date ranges resolve against the current date and the column average is computed onapplyAutoFilter(). -
setColumnDateFilter
A date grouping filter (ECMA-376 §18.3.2.4) on a column: a date cell survivesapplyAutoFilter()if it falls inside any ofitems. Blank cells are hidden; use theincludeBlankoverload to keep them. -
setColumnDateFilter
A date grouping filter that optionally keeps blank cells too. -
clearColumnFilter
public void clearColumnFilter(int columnIndex) Remove the filter from a single column. -
sortByColor
public void sortByColor(Range range, int sortColumnIndex, boolean cellColor, boolean hasHeader, Color... colors) Sort the rows ofrangeby cell fill color (or font color whencellColoris false) atsortColumnIndex(0-based, relative to the range start). Rows are ordered by their color's position incolors; unlisted colors sort last (stable). WhenhasHeaderis true the first row is left in place. -
applyAutoFilter
public int applyAutoFilter()Execute the auto-filter: hides every data row failing any column's criteria and shows the rest. Returns the number of rows hidden. All filter kinds are evaluated — values, custom, color, Top-10, dynamic (dates resolve against the current date; weeks start on Sunday), and date grouping.Setting or clearing a column criterion already runs it; call this to re-run the filter after the data under it changed.
-
applyAdvancedFilter
Run an advanced filter (Excel's Data > Advanced) overlistRangein place, hiding the data rows that do not matchcriteriaRange. Both ranges include a header row; criteria headers are matched to list columns by name. Criteria rows are OR-ed and the cells within one row AND-ed; each criterion cell is empty (no constraint), a comparison (>100, <=50, <>East, =East), or a bare value (numbers match by equality, text "begins with", both honoring*/?wildcards). WhenuniqueOnlyis set, duplicate matching rows are also hidden, keeping the first. Returns the number of rows hidden. -
applyAdvancedFilterCopyTo
public int applyAdvancedFilterCopyTo(Range listRange, Range criteriaRange, Range destination, boolean uniqueOnly) Advanced filter in "Copy to another location" mode: instead of hiding source rows, writes the list header plus each matching row (seeapplyAdvancedFilter(Range, Range, boolean)for the criteria semantics) starting at the top-left cell ofdestination. Cells are copied whole (value, style, formula). Returns the number of data rows written (header excluded). -
groupRows
public void groupRows(int startRow, int endRow) Group rows[startRow, endRow]at outline level 1. -
setRowGroupCollapsed
public void setRowGroupCollapsed(int startRow, int endRow, boolean collapsed) Collapse or expand a grouped row range (Excel's outline +/- button): hides/shows the detail rows and stamps thecollapsedflag on the group's summary row (below the group when the sheet summarizes below). -
setColumnGroupCollapsed
public void setColumnGroupCollapsed(int startCol, int endCol, boolean collapsed) Collapse or expand a grouped column range — the column analogue. -
setRowsOutlineLevel
public void setRowsOutlineLevel(int startRow, int endRow, int level) Set the outline level0..7on rows[startRow, endRow](0 ungroups). -
groupColumns
public void groupColumns(int startCol, int endCol) Group columns[startCol, endCol]at outline level 1. -
setColumnsOutlineLevel
public void setColumnsOutlineLevel(int startCol, int endCol, int level) Set the outline level0..7on columns[startCol, endCol]. -
rowOutlineLevel
public int rowOutlineLevel(int row) A row's outline level (0 = not grouped). -
autoFitRow
public void autoFitRow(int row) Auto-fit a row's height from the default font size. -
autoFitColumn
public void autoFitColumn(int col) Auto-fit a column's width to its widest cell value. -
subtotal
public int subtotal(int firstRow, int lastRow, int groupColumn, SubtotalFunction function, int... subtotalColumns) Insert subtotals into the sorted data block[firstRow, lastRow]: after each run of equal values ingroupColumn, a summary row offunctionoversubtotalColumnsis inserted (plus a grand total). Data rows get outline level 1. Returns the number of rows inserted.Like Excel, the grand total is one
SUBTOTALover the whole data body rather than aSUMof the group summaries: SUBTOTAL ignores the summaries caught inside that span, so the span keeps totalling correctly when a row is later inserted into a group.Every row of the block is data — pass
hasHeadersto the overload below for Excel's Data > Subtotal behaviour instead. -
subtotal
public int subtotal(int firstRow, int lastRow, int groupColumn, boolean hasHeaders, SubtotalFunction function, int... subtotalColumns) Insert subtotals into[firstRow, lastRow]as above. WithhasHeadersthe block follows Excel's Data > Subtotal contract: leading blank rows and the first non-blank row (the header) stay in place and never form a group of their own. WithhasHeadersfalse every row of the block is data. Returns the number of rows inserted. -
consolidate
public int[] consolidate(int destRow, int destColumn, ConsolidateFunction function, Range... sources) Consolidate several equally-shaped source ranges (possibly on other sheets) into this sheet at(destRow, destColumn)usingfunction, aggregating by position. Returns{rows, columns}written. -
addSparkline
Add a sparkline group ("line","column", or"stacked") that drawsdataRef(e.g."Sheet1!A1:A10") into the celllocationRef(e.g."B1"). -
setSparklineStyle
Replaces the style (colors + point-highlight flags) of thegroup-th sparkline group — the styling counterpart ofaddSparkline(java.lang.String, java.lang.String, java.lang.String); read the current state back viasparklines()andSparklineGroup.style(). Returns whether the group index matched. -
sparklineGroupCount
public int sparklineGroupCount()Number of sparkline groups on this sheet. -
sparklines
All sparkline groups on this sheet (ECMA-376 Part 4 §18.3.1.32,x14:sparklineGroups): the group type, basic marker/highlight style, series color and each sparkline's data range and draw location. The read-side counterpart ofaddSparkline(String, String, String). -
addShape
Add a drawing shape (e.g."rect","ellipse","roundRect") with optionaltext, anchored over the cell rectangle(fromRow,fromCol)..(toRow,toCol). -
groupShapes
Group existing shapes into one<xdr:grpSp>container (Excel's "Group").shapeIndexesare this sheet's shape indexes; at least two ungrouped, non-group shapes are required. The members keep their indexes and the group is appended as a new shape entry whose anchor is the members' bounding box. Returns the group's shape index, or-1when the set is not groupable. -
ungroupShapes
public boolean ungroupShapes(int shapeIndex) Dissolve a group created bygroupShapes(java.lang.String, int...): members return to standalone emission and the group entry is removed. Returns whethershapeIndexwas such a group (imported verbatim groups are not dissolvable — their children exist only inside the captured XML). -
addTextBox
Add a text box (arectshape carryingtext); returns the new shape's index. -
addConnector
Add a connector shape (<xdr:cxnSp>) with the given preset geometry name (e.g."straightConnector1","bentConnector3","curvedConnector3","line"), anchored over the cell rectangle(fromRow,fromCol)..(toRow,toCol). The connector shares the shape index space withaddShape(java.lang.String, java.lang.String, int, int, int, int);shapeType(int)reports it as"connector:<preset>". -
shapeCount
public int shapeCount()Number of shapes on this sheet. -
removeShape
public boolean removeShape(int shapeIndex) Remove the shape atshapeIndex(0-based, the same index used byshapeType(int)); returns whether it existed. -
shapeType
The geometry token of the shape atshapeIndex(e.g."rect"). Connector shapes are reported as"connector:<preset>"(e.g."connector:straightConnector1"); group containers as"group". -
shapeText
The shape's text body, ornull. -
shapeFillColor
The shape's solid fill color, ornull(no / non-RGB fill). -
shapeLineColor
The shape's line (outline) color, ornull. -
shapeStyleXml
The raw inner XML of the shape's<xdr:style>theme style-matrix reference (thelnRef/fillRef/effectRef/fontRefchildren), ornullwhen the shape has no such block. The reference is theme-relative, so it round-trips as long as the workbook theme is preserved. -
shapeRotation
public double shapeRotation(int shapeIndex) The shape's rotation in degrees (clockwise). -
shapeFlip
public boolean[] shapeFlip(int shapeIndex) {flipHorizontal, flipVertical}, or an empty array when out of range. -
shapeAnchor
public int[] shapeAnchor(int shapeIndex) {fromRow, fromCol, toRow, toCol}, or an empty array when out of range. -
setShapeFillColor
Set (or clear withnull) the shape's solid fill color. -
setShapeLineColor
Set (or clear withnull) the shape's line (outline) color. -
setShapeStyleXml
Set (or clear withnull) the shape's<xdr:style>theme style-matrix reference from raw inner XML (thelnRef/fillRef/effectRef/fontRefchildren, without the enclosing<xdr:style>tags). Pair withshapeStyleXml(int)to carry a theme-relative fill / line / effect / font across a rebuild. -
setShapeRotation
public void setShapeRotation(int shapeIndex, double degrees) Set the shape's rotation in degrees (clockwise). -
setShapeText
Set (or clear withnull) the shape's text body. -
setShapeFlip
public void setShapeFlip(int shapeIndex, boolean flipHorizontal, boolean flipVertical) Set the shape's horizontal / vertical flip flags. -
shapeHyperlink
The hyperlink URL attached to the shape via DrawingMLhlinkClick, ornullwhen the shape has no hyperlink. -
setShapeHyperlink
Set (or clear withnull) the shape's hyperlink URL. Saved as a drawing-level external hyperlink relationship plus the<a:hlinkClick r:id>element on the shape. -
shapeAltText
The shape's alternative text (cNvPr/@descr), ornull. -
setShapeAltText
Set (or clear withnull) the shape's alternative text. -
shapeName
The shape's drawing name (<xdr:cNvPr name>, ECMA-376 Part 1 §20.5.2.16) — what Excel shows in the Name Box and what a macro uses to address the shape. A shape added through this SDK is given a generated one;nullwhen there is no shape at that index. -
setShapeName
Renames a shape. Returnsfalsefor an empty name or an index with no shape — a blankcNvPr/@namewould leave the shape unreachable from both the Name Box and any macro. -
renderChartToPng
public byte[] renderChartToPng(int chartIndex, int width, int height) Render the chart atchartIndexto PNG image bytes at the given pixel size, ornullif the index is out of range. -
renderChartToSvg
Render the chart atchartIndexto a standalone SVG document at the given pixel size, ornullif the index is out of range.The vector counterpart of
renderChartToPng(int, int, int): text comes out as<text>and the plot as paths, so the picture scales and prints at whatever resolution it is put on. The vector path draws the classic chart families (bar, column, line, pie, doughnut, scatter, area, radar, bubble, stock); another family produces a document with the frame and a comment naming the type rather than a drawing of it, so render those to PNG.
-