Modifier and Type | Field and Description |
---|---|
protected InternalWorkbook |
_book |
protected HSSFWorkbook |
_workbook |
static int |
INITIAL_CAPACITY
Used for compile-time optimization.
(用于编译时优化。)
|
BottomMargin, FooterMargin, HeaderMargin, LeftMargin, PANE_LOWER_LEFT, PANE_LOWER_RIGHT, PANE_UPPER_LEFT, PANE_UPPER_RIGHT, RightMargin, TopMargin
Modifier | Constructor and Description |
---|---|
protected |
HSSFSheet(HSSFWorkbook workbook)
Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from scratch.
(创建新的 HSSFSheet - 由 HSSFWorkbook 调用以从头开始创建工作表。)
|
protected |
HSSFSheet(HSSFWorkbook workbook, InternalSheet sheet)
Creates an HSSFSheet representing the given Sheet object.
(创建一个表示给定 Sheet 对象的 HSSFSheet。)
|
Modifier and Type | Method and Description |
---|---|
int |
addMergedRegion(CellRangeAddress region)
Adds a merged region of cells on a sheet.
(在工作表上添加单元格的合并区域。)
|
int |
addMergedRegionUnsafe(CellRangeAddress region)
Adds a merged region of cells (hence those cells form one).
(添加单元格的合并区域(因此这些单元格形成一个)。)
|
void |
addValidationData(DataValidation dataValidation)
Creates a data validation object
(创建数据验证对象)
|
void |
autoSizeColumn(int column)
Adjusts the column width to fit the contents.
(调整列宽以适合内容。)
|
void |
autoSizeColumn(int column, boolean useMergedCells)
Adjusts the column width to fit the contents.
(调整列宽以适合内容。)
|
HSSFPatriarch |
createDrawingPatriarch()
Creates the top-level drawing patriarch.
(创建顶级图形族长。)
|
void |
createFreezePane(int colSplit, int rowSplit)
Creates a split (freezepane).
(创建一个拆分(冻结窗格)。)
|
void |
createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)
Creates a split (freezepane).
(创建一个拆分(冻结窗格)。)
|
HSSFRow |
createRow(int rownum)
Create a new row within the sheet and return the high level representation
(在工作表中创建一个新行并返回高级表示)
|
void |
createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)
Creates a split pane.
(创建一个拆分窗格。)
|
void |
dumpDrawingRecords(boolean fat, java.io.PrintWriter pw)
Aggregates the drawing records and dumps the escher record hierarchy to the standard output.
(聚合绘图记录并将 escher 记录层次结构转储到标准输出。)
|
protected HSSFComment |
findCellComment(int row, int column) |
CellAddress |
getActiveCell()
Return location of the active cell, e.g.
(返回活动小区的位置,例如)
|
boolean |
getAlternateExpression()
whether alternate expression evaluation is on
(替代表达式评估是否打开)
|
boolean |
getAlternateFormula()
whether alternative formula entry is on
(替代公式条目是否打开)
|
boolean |
getAutobreaks()
show automatic page breaks or not
(是否显示自动分页符)
|
HSSFComment |
getCellComment(CellAddress ref)
Returns cell comment for the specified row and column
(返回指定行和列的单元格注释)
|
java.util.Map<CellAddress,HSSFComment> |
getCellComments()
Returns all cell comments on this sheet.
(返回此工作表上的所有单元格注释。)
|
int[] |
getColumnBreaks()
Retrieves all the vertical page breaks
(检索所有垂直分页符)
|
int |
getColumnOutlineLevel(int columnIndex)
Returns the column outline level.
(返回列大纲级别。)
|
HSSFCellStyle |
getColumnStyle(int column)
Returns the HSSFCellStyle that applies to the given (0 based) column, or null if no style has been set for that column
(返回应用于给定(基于 0)列的 HSSFCellStyle,如果没有为该列设置样式,则返回 null)
|
int |
getColumnWidth(int columnIndex)
get the width (in units of 1/256th of a character width )
(获取宽度(以字符宽度的 1/256 为单位))
|
float |
getColumnWidthInPixels(int column)
get the width in pixel
(获取像素宽度)
|
DataValidationHelper |
getDataValidationHelper() |
java.util.List<HSSFDataValidation> |
getDataValidations()
Returns the list of DataValidation in the sheet.
(返回工作表中的 DataValidation 列表。)
|
int |
getDefaultColumnWidth()
get the default column width for the sheet (if the columns do not define their own width) in characters
(以字符为单位获取工作表的默认列宽(如果列未定义自己的宽度))
|
short |
getDefaultRowHeight()
get the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)
(获取工作表的默认行高(如果行没有定义自己的高度),单位为缇(1/20 点))
|
float |
getDefaultRowHeightInPoints()
get the default row height for the sheet (if the rows do not define their own height) in points.
(以点为单位获取工作表的默认行高(如果行没有定义自己的高度)。)
|
boolean |
getDialog()
get whether sheet is a dialog sheet or not
(获取工作表是否为对话框工作表)
|
boolean |
getDisplayGuts()
get whether to display the guts or not
(获取是否显示胆量)
|
EscherAggregate |
getDrawingEscherAggregate()
Returns the agregate escher records for this sheet, it there is one.
(返回此工作表的聚合 escher 记录,它有一个。)
|
HSSFPatriarch |
getDrawingPatriarch()
This will hold any graphics or charts for the sheet.
(这将保存工作表的任何图形或图表。)
|
int |
getFirstRowNum()
Gets the first row on the sheet
(获取工作表的第一行)
|
boolean |
getFitToPage()
fit to page option is on
(适合页面选项已打开)
|
HSSFFooter |
getFooter()
Gets the user model for the default document footer.
(获取默认文档页脚的用户模型。)
|
boolean |
getForceFormulaRecalculation()
Whether a record must be inserted or not at generation to indicate that formula must be recalculated when workbook is opened.
(是否必须在生成时插入记录以指示在打开工作簿时必须重新计算公式。)
|
HSSFHeader |
getHeader()
Gets the user model for the default document header.
(获取默认文档标题的用户模型。)
|
boolean |
getHorizontallyCenter()
Determine whether printed output for this sheet will be horizontally centered.
(确定此工作表的打印输出是否水平居中。)
|
HSSFHyperlink |
getHyperlink(CellAddress addr)
Get a Hyperlink in this sheet located in a cell specified by {code addr}
(在此工作表中获取位于 {code addr} 指定的单元格中的超链接)
|
HSSFHyperlink |
getHyperlink(int row, int column)
Get a Hyperlink in this sheet anchored at row, column
(在此工作表中获取锚定在行、列的超链接)
|
java.util.List<HSSFHyperlink> |
getHyperlinkList()
Get a list of Hyperlinks in this sheet
(获取此工作表中的超链接列表)
|
int |
getLastRowNum()
Gets the number last row on the sheet.
(获取工作表上最后一行的编号。)
|
short |
getLeftCol()
The left col in the visible view when the sheet is first viewed after opening it in a viewer
(在查看器中打开工作表后首次查看工作表时可见视图中的左列)
|
double |
getMargin(short margin)
Gets the size of the margin in inches.
(以英寸为单位获取边距的大小。)
|
CellRangeAddress |
getMergedRegion(int index)
Returns the merged region at the specified index
(返回指定索引处的合并区域)
|
java.util.List<CellRangeAddress> |
getMergedRegions()
Returns the list of merged regions.
(返回合并区域的列表。)
|
int |
getNumMergedRegions()
returns the number of merged regions
(返回合并区域的数量)
|
boolean |
getObjectProtect()
Answer whether object protection is enabled or disabled
(回答对象保护是启用还是禁用)
|
PaneInformation |
getPaneInformation()
Returns the information regarding the currently configured pane (split or freeze).
(返回有关当前配置的窗格(拆分或冻结)的信息。)
|
short |
getPassword() |
int |
getPhysicalNumberOfRows()
Returns the number of physically defined rows (NOT the number of rows in the sheet)
(返回物理定义的行数(不是工作表中的行数))
|
HSSFPrintSetup |
getPrintSetup()
Gets the print setup object.
(获取打印设置对象。)
|
boolean |
getProtect()
Answer whether protection is enabled or disabled
(回答保护是启用还是禁用)
|
CellRangeAddress |
getRepeatingColumns()
Gets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet.
(获取打印工作表时使用的重复列,如 File->PageSetup->Sheet 中所示。)
|
CellRangeAddress |
getRepeatingRows()
Gets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet.
(获取打印工作表时使用的重复行,如 File->PageSetup->Sheet 中所示。)
|
HSSFRow |
getRow(int rowIndex)
Returns the logical row (not physical) 0-based.
(返回基于 0 的逻辑行(非物理行)。)
|
int[] |
getRowBreaks()
Retrieves all the horizontal page breaks
(检索所有水平分页符)
|
boolean |
getRowSumsBelow()
get if row summaries appear below detail in the outline
(获取行摘要是否出现在大纲中的详细信息下方)
|
boolean |
getRowSumsRight()
get if col summaries appear right of the detail in the outline
(获取列摘要是否出现在大纲中详细信息的右侧)
|
boolean |
getScenarioProtect()
Answer whether scenario protection is enabled or disabled
(回答是否启用或禁用场景保护)
|
InternalSheet |
getSheet()
used internally in the API to get the low level Sheet record represented by this Object.
(在 API 内部用于获取此对象表示的低级别工作表记录。)
|
HSSFSheetConditionalFormatting |
getSheetConditionalFormatting()
The 'Conditional Formatting' facet for this
Sheet
(此工作表的“条件格式”方面)
|
java.lang.String |
getSheetName()
Returns the name of this sheet
(返回此工作表的名称)
|
short |
getTopRow()
The top row in the visible view when the sheet is first viewed after opening it in a viewer
(在查看器中打开工作表后首次查看工作表时可见视图中的顶行)
|
boolean |
getVerticallyCenter()
Determine whether printed output for this sheet will be vertically centered.
(确定此工作表的打印输出是否垂直居中。)
|
HSSFWorkbook |
getWorkbook()
Return the parent workbook
(返回父工作簿)
|
void |
groupColumn(int fromColumn, int toColumn)
Create an outline for the provided column range.
(为提供的列范围创建大纲。)
|
void |
groupRow(int fromRow, int toRow)
Tie a range of cell together so that they can be collapsed or expanded
(将一系列单元格连接在一起,以便它们可以折叠或展开)
|
protected void |
insertChartRecords(java.util.List<Record> records) |
boolean |
isActive() |
boolean |
isColumnBroken(int column)
Determines if there is a page break at the indicated column
(确定指示的列是否有分页符)
|
boolean |
isColumnHidden(int columnIndex)
Get the hidden state for a given column.
(获取给定列的隐藏状态。)
|
boolean |
isDisplayFormulas()
Returns if formulas are displayed.
(如果显示公式则返回。)
|
boolean |
isDisplayGridlines()
Returns if gridlines are displayed.
(如果显示网格线则返回。)
|
boolean |
isDisplayRowColHeadings()
Returns if RowColHeadings are displayed.
(如果显示 RowColHeadings,则返回。)
|
boolean |
isDisplayZeros()
Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value.
(获取指示窗口是否应在包含零值的单元格中显示 0(零)的标志。)
|
boolean |
isGridsPrinted()
get whether gridlines are printed.
(获取是否打印网格线。)
|
boolean |
isPrintGridlines()
Returns whether gridlines are printed.
(返回是否打印网格线。)
|
boolean |
isPrintRowAndColumnHeadings()
Returns whether row and column headings are printed.
(返回是否打印行和列标题。)
|
boolean |
isRightToLeft()
Whether the text is displayed in right-to-left mode in the window
(文本是否在窗口中以从右到左的方式显示)
|
boolean |
isRowBroken(int row)
Determines if there is a page break at the indicated row
(确定指示行是否有分页符)
|
boolean |
isSelected()
Note - this is not the same as whether the sheet is focused (isActive)
(注意 - 这与工作表是否聚焦(isActive)不同)
|
java.util.Iterator<Row> |
iterator()
Alias for
rowIterator() to allow foreach loops
(rowIterator() 的别名以允许 foreach 循环)
|
protected void |
preSerialize()
check whether the data of sheet can be serialized
(检查sheet的数据是否可以序列化)
|
void |
protectSheet(java.lang.String password)
Sets the protection enabled as well as the password
(设置启用的保护以及密码)
|
CellRange<HSSFCell> |
removeArrayFormula(Cell cell)
Remove a Array Formula from this sheet.
(从此工作表中删除一个数组公式。)
|
void |
removeColumnBreak(int column)
Removes a page break at the indicated column
(删除指定列的分页符)
|
protected void |
removeHyperlink(HSSFHyperlink link)
Remove the underlying HyperlinkRecord from this sheet.
(从此工作表中删除基础 HyperlinkRecord。)
|
protected void |
removeHyperlink(HyperlinkRecord link)
Remove the underlying HyperlinkRecord from this sheet
(从此工作表中删除底层 HyperlinkRecord)
|
void |
removeMergedRegion(int index)
removes a merged region of cells (hence letting them free)
(删除合并的单元格区域(因此让它们自由))
|
void |
removeMergedRegions(java.util.Collection<java.lang.Integer> indices)
Removes a number of merged regions of cells (hence letting them free)
(删除许多合并的单元格区域(因此让它们自由))
|
void |
removeRow(Row row)
Remove a row from this sheet.
(从此工作表中删除一行。)
|
void |
removeRowBreak(int row)
Removes the page break at the indicated row
(删除指定行的分页符)
|
java.util.Iterator<Row> |
rowIterator()
Returns an iterator of the physical rows
(返回物理行的迭代器)
|
void |
setActive(boolean sel)
Sets whether sheet is selected.
(设置是否选择工作表。)
|
void |
setActiveCell(CellAddress address)
Sets location of the active cell
(设置活动单元格的位置)
|
void |
setAlternativeExpression(boolean b)
whether alternate expression evaluation is on
(替代表达式评估是否打开)
|
void |
setAlternativeFormula(boolean b)
whether alternative formula entry is on
(替代公式条目是否打开)
|
CellRange<HSSFCell> |
setArrayFormula(java.lang.String formula, CellRangeAddress range)
Sets array formula to specified region for result.
(将数组公式设置为结果的指定区域。)
|
void |
setAutobreaks(boolean b)
show automatic page breaks or not
(是否显示自动分页符)
|
HSSFAutoFilter |
setAutoFilter(CellRangeAddress range)
Enable filtering for a range of cells
(为一系列单元格启用过滤)
|
void |
setColumnBreak(int column)
Sets a page break at the indicated column.
(在指示的列处设置分页符。)
|
void |
setColumnGroupCollapsed(int columnNumber, boolean collapsed)
Expands or collapses a column group.
(展开或折叠列组。)
|
void |
setColumnHidden(int columnIndex, boolean hidden)
Get the visibility state for a given column.
(获取给定列的可见性状态。)
|
void |
setColumnWidth(int columnIndex, int width)
Set the width (in units of 1/256th of a character width)
(设置宽度(以字符宽度的 1/256 为单位))
|
void |
setDefaultColumnStyle(int column, CellStyle style)
Sets the default column style for a given column.
(设置给定列的默认列样式。)
|
void |
setDefaultColumnWidth(int width)
set the default column width for the sheet (if the columns do not define their own width) in characters
(以字符为单位设置工作表的默认列宽(如果列没有定义自己的宽度))
|
void |
setDefaultRowHeight(short height)
set the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)
(以缇为单位设置工作表的默认行高(如果行没有定义自己的高度)(1/20 点))
|
void |
setDefaultRowHeightInPoints(float height)
set the default row height for the sheet (if the rows do not define their own height) in points
(以点为单位设置工作表的默认行高(如果行没有定义自己的高度))
|
void |
setDialog(boolean b)
set whether sheet is a dialog sheet or not
(设置工作表是否为对话框工作表)
|
void |
setDisplayFormulas(boolean show)
Sets whether the formulas are shown in a viewer.
(设置公式是否显示在查看器中。)
|
void |
setDisplayGridlines(boolean show)
Sets whether the gridlines are shown in a viewer.
(设置是否在查看器中显示网格线。)
|
void |
setDisplayGuts(boolean b)
set whether to display the guts or not
(设置是否显示胆量)
|
void |
setDisplayRowColHeadings(boolean show)
Sets whether the RowColHeadings are shown in a viewer.
(设置 RowColHeadings 是否显示在查看器中。)
|
void |
setDisplayZeros(boolean value)
Set whether the window should show 0 (zero) in cells containing zero value.
(设置窗口是否应在包含零值的单元格中显示 0(零)。)
|
void |
setFitToPage(boolean b)
fit to page option is on
(适合页面选项已打开)
|
void |
setForceFormulaRecalculation(boolean value)
Control if Excel should be asked to recalculate all formulas on this sheet when the workbook is opened.
(控制打开工作簿时是否应要求 Excel 重新计算此工作表上的所有公式。)
|
void |
setGridsPrinted(boolean value)
set whether gridlines printed.
(设置是否打印网格线。)
|
void |
setHorizontallyCenter(boolean value)
determines whether the output is horizontally centered on the page.
(确定输出是否在页面上水平居中。)
|
void |
setMargin(short margin, double size)
Sets the size of the margin in inches.
(以英寸为单位设置边距的大小。)
|
void |
setPrintGridlines(boolean show)
Turns on or off the printing of gridlines.
(打开或关闭网格线的打印。)
|
void |
setPrintRowAndColumnHeadings(boolean show)
Turns on or off the printing of row and column headings.
(打开或关闭行和列标题的打印。)
|
void |
setRepeatingColumns(CellRangeAddress columnRangeRef)
Sets the repeating columns used when printing the sheet, as found in File->PageSetup->Sheet.
(设置打印工作表时使用的重复列,如 File->PageSetup->Sheet 中所示。)
|
void |
setRepeatingRows(CellRangeAddress rowRangeRef)
Sets the repeating rows used when printing the sheet, as found in File->PageSetup->Sheet.
(设置打印工作表时使用的重复行,如 File->PageSetup->Sheet 中所示。)
|
void |
setRightToLeft(boolean value)
Sets whether the worksheet is displayed from right to left instead of from left to right.
(设置工作表是否从右到左而不是从左到右显示。)
|
void |
setRowBreak(int row)
Sets a page break at the indicated row Breaks occur above the specified row and left of the specified column inclusive.
(在指示的行处设置分页符 分页符发生在指定行的上方和指定列的左侧(含)。)
|
void |
setRowGroupCollapsed(int rowIndex, boolean collapse)
Set view state of a grouped range of rows
(设置一组行的视图状态)
|
void |
setRowSumsBelow(boolean b)
set if row summaries appear below detail in the outline
(如果行摘要出现在大纲中的详细信息下方,则设置)
|
void |
setRowSumsRight(boolean b)
set if col summaries appear right of the detail in the outline
(如果 col 摘要出现在大纲中细节的右侧,则设置)
|
void |
setSelected(boolean sel)
Sets whether sheet is selected.
(设置是否选择工作表。)
|
void |
setVerticallyCenter(boolean value)
determines whether the output is vertically centered on the page.
(确定输出是否在页面上垂直居中。)
|
void |
setZoom(int scale)
Window zoom magnification for current view representing percent values.
(表示百分比值的当前视图的窗口缩放比例。)
|
void |
setZoom(int numerator, int denominator)
Sets the zoom magnification for the sheet.
(设置工作表的缩放倍率。)
|
void |
shiftColumns(int startColumn, int endColumn, int n)
Shifts columns in range [startColumn, endColumn] for n places to the right.
(将范围 [startColumn, endColumn] 中的列向右移动 n 个位置。)
|
protected void |
shiftMerged(int startRow, int endRow, int n, boolean isRow)
Deprecated.
POI 3.15 beta 2. Use
(已弃用。 POI 3.15 beta 2. 使用 RowShifter.shiftMergedRegions(int, int, int)。)
RowShifter.shiftMergedRegions(int, int, int) .
|
void |
shiftRows(int startRow, int endRow, int n)
Shifts rows between startRow and endRow n number of rows.
(在 startRow 和 endRow 之间移动行 n 行。)
|
void |
shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)
Shifts rows between startRow and endRow n number of rows.
(在 startRow 和 endRow 之间移动行 n 行。)
|
void |
shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight, boolean moveComments)
Shifts rows between startRow and endRow n number of rows.
(在 startRow 和 endRow 之间移动行 n 行。)
|
void |
showInPane(int topRow, int leftCol)
Sets desktop window pane display area, when the file is first opened in a viewer.
(当文件第一次在查看器中打开时,设置桌面窗口窗格的显示区域。)
|
void |
ungroupColumn(int fromColumn, int toColumn)
Ungroup a range of columns that were previously grouped
(取消组合之前分组的一系列列)
|
void |
ungroupRow(int fromRow, int toRow)
Ungroup a range of rows that were previously grouped
(取消组合之前分组的一系列行)
|
protected void |
validateColumn(int column)
Runs a bounds check for column numbers
(对列号运行边界检查)
|
void |
validateMergedRegions()
Verify that merged regions do not intersect multi-cell array formulas and no merged regions intersect another merged region in this sheet.
(验证合并区域不会与多单元格数组公式相交,并且没有合并区域与此工作表中的另一个合并区域相交。)
|
protected void |
validateRow(int row)
Runs a bounds check for row numbers
(对行号运行边界检查)
|
public static final int INITIAL_CAPACITY
protected final InternalWorkbook _book
protected final HSSFWorkbook _workbook
protected HSSFSheet(HSSFWorkbook workbook)
workbook
- - The HSSF Workbook object associated with the sheet.
(workbook - - 与工作表关联的 HSSF Workbook 对象。)
HSSFWorkbook.createSheet()
protected HSSFSheet(HSSFWorkbook workbook, InternalSheet sheet)
workbook
- - The HSSF Workbook object associated with the sheet.
(workbook - - 与工作表关联的 HSSF Workbook 对象。)
sheet
- - lowlevel Sheet object this sheet will represent
(sheet - - 此工作表将代表的低级工作表对象)
HSSFWorkbook.createSheet()
protected void preSerialize()
public HSSFWorkbook getWorkbook()
getWorkbook
in interface
Sheet
(接口表中的getWorkbook)
public HSSFRow createRow(int rownum)
createRow
in interface
Sheet
(界面Sheet中的createRow)
rownum
- row number
(rownum - 行号)
HSSFRow
,
removeRow(org.apache.poi.ss.usermodel.Row)
public void removeRow(Row row)
public HSSFRow getRow(int rowIndex)
public int getPhysicalNumberOfRows()
getPhysicalNumberOfRows
in interface
Sheet
(接口表中的 getPhysicalNumberOfRows)
public int getFirstRowNum()
getFirstRowNum
in interface
Sheet
(接口表中的 getFirstRowNum)
public int getLastRowNum()
getPhysicalNumberOfRows()
to tell if there is a row at position zero or not.
(获取工作表上最后一行的编号。由于 excel 文件格式的特殊性,如果调用此方法的结果为零,您无法判断这是否意味着工作表上有零行,或者在位置零处有 1 行。对于这种情况,另外调用 getPhysicalNumberOfRows() 来判断位置零是否有行。)
getLastRowNum
in interface
Sheet
(接口表中的 getLastRowNum)
public java.util.List<HSSFDataValidation> getDataValidations()
Sheet
getDataValidations
in interface
Sheet
(接口表中的 getDataValidations)
public void addValidationData(DataValidation dataValidation)
addValidationData
in interface
Sheet
(接口表中的 addValidationData)
dataValidation
- The Data validation object settings
(dataValidation - 数据验证对象设置)
public void setColumnHidden(int columnIndex, boolean hidden)
setColumnHidden
in interface
Sheet
(界面Sheet中的setColumnHidden)
columnIndex
- - the column to get (0-based)
(columnIndex - - 要获取的列(从 0 开始))
hidden
- - the visiblity state of the column
(hidden - - 列的可见性状态)
public boolean isColumnHidden(int columnIndex)
isColumnHidden
in interface
Sheet
(isColumnHidden 在界面表中)
columnIndex
- - the column to set (0-based)
(columnIndex - - 要设置的列(从 0 开始))
false
if the column is visible
(hidden - 如果该列可见,则为 false)
public void setColumnWidth(int columnIndex, int width)
The maximum column width for an individual cell is 255 characters. This value represents the number of characters that can be displayed in a cell that is formatted with the standard font (first font in the workbook).
Character width is defined as the maximum digit width of the numbers 0, 1, 2, ... 9
as rendered using the default font (first font in the workbook).
Unless you are using a very special font, the default character is '0' (zero), this is true for Arial (default font font in HSSF) and Calibri (default font in XSSF)
Please note, that the width set by this method includes 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines (Section 3.3.1.12 of the OOXML spec). This results is a slightly less value of visible characters than passed to this method (approx. 1/2 of a character).
To compute the actual number of visible characters, Excel uses the following formula (Section 3.3.1.12 of the OOXML spec):
width = Truncate([{Number of Visible Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256
Using the Calibri font as an example, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi). If you set a column width to be eight characters wide, e.g. setColumnWidth(columnIndex, 8*256)
, then the actual value of visible characters (the value shown in Excel) is derived from the following equation: Truncate([numChars*7+5]/7*256)/256 = 8;
which gives 7.29
.
setColumnWidth
in interface
Sheet
(界面Sheet中的setColumnWidth)
columnIndex
- - the column to set (0-based)
(columnIndex - - 要设置的列(从 0 开始))
width
- - the width in units of 1/256th of a character width
(width - 以字符宽度的 1/256 为单位的宽度)
java.lang.IllegalArgumentException
- if width > 255*256 (the maximum column width in Excel is 255 characters)
(java.lang.IllegalArgumentException - 如果宽度 > 255*256(Excel 中的最大列宽为 255 个字符))
public int getColumnWidth(int columnIndex)
getColumnWidth
in interface
Sheet
(接口表中的getColumnWidth)
columnIndex
- - the column to set (0-based)
(columnIndex - - 要设置的列(从 0 开始))
public float getColumnWidthInPixels(int column)
Sheet
Please note, that this method works correctly only for workbooks with the default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx). If the default font is changed the column width can be stretched
(以像素为单位获取宽度 请注意,此方法仅适用于具有默认字体大小的工作簿(Arial 10pt 用于 .xls,Calibri 11pt 用于 .xlsx)。如果更改默认字体,则可以拉伸列宽)getColumnWidthInPixels
in interface
Sheet
(接口表中的 getColumnWidthInPixels)
column
- - the column to set (0-based)
(column - - 要设置的列(从 0 开始))
public int getDefaultColumnWidth()
getDefaultColumnWidth
in interface
Sheet
(接口表中的getDefaultColumnWidth)
public void setDefaultColumnWidth(int width)
setDefaultColumnWidth
in interface
Sheet
(界面表中的 setDefaultColumnWidth)
width
- default column width
(width - 默认列宽)
public short getDefaultRowHeight()
getDefaultRowHeight
in interface
Sheet
(接口表中的getDefaultRowHeight)
public float getDefaultRowHeightInPoints()
getDefaultRowHeightInPoints
in interface
Sheet
(接口表中的 getDefaultRowHeightInPoints)
public void setDefaultRowHeight(short height)
setDefaultRowHeight
in interface
Sheet
(接口表中的 setDefaultRowHeight)
height
- default row height
(height - 默认行高)
public void setDefaultRowHeightInPoints(float height)
setDefaultRowHeightInPoints
in interface
Sheet
(接口表中的 setDefaultRowHeightInPoints)
height
- default row height
(height - 默认行高)
public HSSFCellStyle getColumnStyle(int column)
getColumnStyle
in interface
Sheet
(界面Sheet中的getColumnStyle)
public boolean isGridsPrinted()
public void setGridsPrinted(boolean value)
value
- false if not printed.
(value - 如果不打印,则为 false。)
public int addMergedRegion(CellRangeAddress region)
addMergedRegion
in interface
Sheet
(界面Sheet中的addMergedRegion)
region
- to merge
(区域 - 合并)
java.lang.IllegalArgumentException
- if region contains fewer than 2 cells
(java.lang.IllegalArgumentException - 如果区域包含少于 2 个单元格)
java.lang.IllegalStateException
- if region intersects with a multi-cell array formula
(java.lang.IllegalStateException - 如果区域与多单元格数组公式相交)
java.lang.IllegalStateException
- if region intersects with an existing region on this sheet
(java.lang.IllegalStateException - 如果区域与此工作表上的现有区域相交)
public int addMergedRegionUnsafe(CellRangeAddress region)
validateMergedRegions()
, which runs in O(n^2) time.
(添加单元格的合并区域(因此这些单元格形成一个)。跳过验证。可以创建重叠的合并区域或创建与此公式相交的多单元格数组公式的合并区域,这可能会导致工作簿损坏。要在调用 addMergedRegionUnsafe 后检查合并区域是否与数组公式重叠或其他合并区域,请调用 validateMergedRegions(),它在 O(n^2) 时间内运行。)
addMergedRegionUnsafe
in interface
Sheet
(接口 Sheet 中的 addMergedRegionUnsafe)
region
- to merge
(区域 - 合并)
java.lang.IllegalArgumentException
- if region contains fewer than 2 cells
(java.lang.IllegalArgumentException - 如果区域包含少于 2 个单元格)
public void validateMergedRegions()
validateMergedRegions
in interface
Sheet
(接口表中的 validateMergedRegions)
java.lang.IllegalStateException
- if region intersects with a multi-cell array formula
(java.lang.IllegalStateException - 如果区域与多单元格数组公式相交)
java.lang.IllegalStateException
- if at least one region intersects with another merged region in this sheet
(java.lang.IllegalStateException - 如果至少一个区域与此工作表中的另一个合并区域相交)
public void setForceFormulaRecalculation(boolean value)
Calculating the formula values with FormulaEvaluator
is the recommended solution, but this may be used for certain cases where evaluation in POI is not possible.
It is recommended to force recalcuation of formulas on workbook level using Workbook.setForceFormulaRecalculation(boolean)
to ensure that all cross-worksheet formuals and external dependencies are updated.
setForceFormulaRecalculation
in interface
Sheet
(接口Sheet中的setForceFormulaRecalculation)
value
- true if the application will perform a full recalculation of this worksheet values when the workbook is opened
(value - 如果应用程序将在打开工作簿时完全重新计算此工作表值,则为 true)
Workbook.setForceFormulaRecalculation(boolean)
public boolean getForceFormulaRecalculation()
getForceFormulaRecalculation
in interface
Sheet
(接口表中的getForceFormulaRecalculation)
public void setVerticallyCenter(boolean value)
setVerticallyCenter
in interface
Sheet
(界面Sheet中的setVerticallyCenter)
value
- true to vertically center, false otherwise.
(value - 垂直居中为真,否则为假。)
public boolean getVerticallyCenter()
getVerticallyCenter
in interface
Sheet
(界面表中的getVerticalCenter)
public void setHorizontallyCenter(boolean value)
setHorizontallyCenter
in interface
Sheet
(界面Sheet中的setHorizontallyCenter)
value
- true to horizontally center, false otherwise.
(value - 水平居中为真,否则为假。)
public boolean getHorizontallyCenter()
getHorizontallyCenter
in interface
Sheet
(界面表中的getHorizontallyCenter)
public void setRightToLeft(boolean value)
setRightToLeft
in interface
Sheet
(界面Sheet中的setRightToLeft)
value
- true for right to left, false otherwise.
(value - 从右到左为 true,否则为 false。)
public boolean isRightToLeft()
isRightToLeft
in interface
Sheet
(界面表中的 isRightToLeft)
public void removeMergedRegion(int index)
removeMergedRegion
in interface
Sheet
(接口表中的 removeMergedRegion)
index
- of the region to unmerge
(index - 要取消合并的区域)
public void removeMergedRegions(java.util.Collection<java.lang.Integer> indices)
removeMergedRegions
in interface
Sheet
(接口表中的 removeMergedRegions)
indices
- A set of the regions to unmerge
(索引 - 一组要取消合并的区域)
public int getNumMergedRegions()
getNumMergedRegions
in interface
Sheet
(接口表中的 getNumMergedRegions)
public CellRangeAddress getMergedRegion(int index)
Sheet
getMergedRegion
in interface
Sheet
(接口表中的getMergedRegion)
public java.util.List<CellRangeAddress> getMergedRegions()
Sheet
getMergedRegions
in interface
Sheet
(接口表中的 getMergedRegions)
public java.util.Iterator<Row> rowIterator()
Sheet
rowIterator
in interface
Sheet
(界面Sheet中的rowIterator)
public java.util.Iterator<Row> iterator()
rowIterator()
to allow foreach loops
(rowIterator() 的别名以允许 foreach 循环)
iterator
in interface
java.lang.Iterable<Row>
(接口 java.lang.Iterable 中的迭代器
@Internal public InternalSheet getSheet()
public void setAlternativeExpression(boolean b)
b
- alternative expression evaluation or not
(b - 替代表达式评估与否)
public void setAlternativeFormula(boolean b)
b
- alternative formulas or not
(b - 替代公式与否)
public void setAutobreaks(boolean b)
setAutobreaks
in interface
Sheet
(界面表中的 setAutobreaks)
b
- whether to show auto page breaks
(b - 是否显示自动分页符)
public void setDialog(boolean b)
b
- isDialog or not
(b - isDialog 与否)
public void setDisplayGuts(boolean b)
setDisplayGuts
in interface
Sheet
(界面表中的 setDisplayGuts)
b
- guts or no guts (or glory)
(b - 胆量或没有胆量(或荣耀))
public void setFitToPage(boolean b)
setFitToPage
in interface
Sheet
(界面Sheet中的setFitToPage)
b
- fit or not
(b - 适合与否)
public void setRowSumsBelow(boolean b)
setRowSumsBelow
in interface
Sheet
(界面Sheet中的setRowSumsBelow)
b
- below or not
(b - 低于与否)
public void setRowSumsRight(boolean b)
setRowSumsRight
in interface
Sheet
(接口表中的 setRowSumsRight)
b
- right or not
(b - 对与否)
public boolean getAlternateExpression()
public boolean getAlternateFormula()
public boolean getAutobreaks()
getAutobreaks
in interface
Sheet
(接口表中的 getAutobreaks)
public boolean getDialog()
public boolean getDisplayGuts()
getDisplayGuts
in interface
Sheet
(接口表中的 getDisplayGuts)
public boolean isDisplayZeros()
In Excel 2003 this option can be changed in the Options dialog on the View tab.
(获取指示窗口是否应在包含零值的单元格中显示 0(零)的标志。当为 false 时,具有零值的单元格显示为空白,而不是显示数字零。在 Excel 2003 中,可以在“视图”选项卡上的“选项”对话框中更改此选项。)isDisplayZeros
in interface
Sheet
(界面表中的 isDisplayZeros)
public void setDisplayZeros(boolean value)
In Excel 2003 this option can be set in the Options dialog on the View tab.
(设置窗口是否应在包含零值的单元格中显示 0(零)。当为 false 时,具有零值的单元格显示为空白,而不是显示数字零。在 Excel 2003 中,可以在“视图”选项卡上的“选项”对话框中设置此选项。)setDisplayZeros
in interface
Sheet
(界面表中的 setDisplayZeros)
value
- whether to display or hide all zero values on the worksheet
(value - 是否在工作表上显示或隐藏所有零值)
public boolean getFitToPage()
getFitToPage
in interface
Sheet
(接口表中的getFitToPage)
public boolean getRowSumsBelow()
getRowSumsBelow
in interface
Sheet
(接口表中的getRowSumsBelow)
public boolean getRowSumsRight()
getRowSumsRight
in interface
Sheet
(接口表中的 getRowSumsRight)
public boolean isPrintGridlines()
isPrintGridlines
in interface
Sheet
(界面Sheet中的isPrintGridlines)
to check if gridlines are displayed on screen
public void setPrintGridlines(boolean show)
setPrintGridlines
in interface
Sheet
(界面Sheet中的setPrintGridlines)
show
- boolean to turn on or off the printing of gridlines
(show - 用于打开或关闭网格线打印的布尔值)
to display gridlines on screen
public boolean isPrintRowAndColumnHeadings()
isPrintRowAndColumnHeadings
in interface
Sheet
(界面Sheet中的isPrintRowAndColumnHeadings)
public void setPrintRowAndColumnHeadings(boolean show)
setPrintRowAndColumnHeadings
in interface
Sheet
(界面Sheet中的setPrintRowAndColumnHeadings)
show
- boolean to turn on or off the printing of row and column headings
(show - 布尔值,用于打开或关闭行和列标题的打印)
public HSSFPrintSetup getPrintSetup()
getPrintSetup
in interface
Sheet
(接口Sheet中的getPrintSetup)
public HSSFHeader getHeader()
Sheet
Note that XSSF offers more kinds of document headers than HSSF does
(获取默认文档标题的用户模型。请注意,XSSF 提供比 HSSF 更多种类的文档标题)public HSSFFooter getFooter()
Sheet
Note that XSSF offers more kinds of document footers than HSSF does.
(获取默认文档页脚的用户模型。请注意,XSSF 提供的文档页脚种类比 HSSF 多。)public boolean isSelected()
isSelected
in interface
Sheet
(界面Sheet中的isSelected)
true
if this sheet is currently selected
(如果当前选择了此工作表,则为 true)
public void setSelected(boolean sel)
setSelected
in interface
Sheet
(界面Sheet中的setSelected)
sel
- Whether to select the sheet or deselect the sheet.
(sel - 是选择工作表还是取消选择工作表。)
Workbook.setActiveSheet(int)
public boolean isActive()
true
if this sheet is currently focused
(如果此工作表当前处于焦点,则为 true)
public void setActive(boolean sel)
sel
- Whether to select the sheet or deselect the sheet.
(sel - 是选择工作表还是取消选择工作表。)
public double getMargin(short margin)
public void setMargin(short margin, double size)
public boolean getProtect()
getProtect
in interface
Sheet
(接口表中的getProtect)
public short getPassword()
public boolean getObjectProtect()
public boolean getScenarioProtect()
getScenarioProtect
in interface
Sheet
(接口表中的 getScenarioProtect)
public void protectSheet(java.lang.String password)
protectSheet
in interface
Sheet
(界面Sheet中的protectSheet)
password
- to set for protection. Pass
null
to remove protection
(密码 - 设置保护。传递 null 以删除保护)
public void setZoom(int numerator, int denominator)
numerator
- The numerator for the zoom magnification.
(分子 - 缩放倍率的分子。)
denominator
- The denominator for the zoom magnification.
(denominator - 缩放倍率的分母。)
setZoom(int)
public void setZoom(int scale)
10 - 10% 20 - 20% ... 100 - 100% ... 400 - 400%(表示百分比值的当前视图的窗口缩放比例。有效值范围从 10 到 400。水平和垂直比例一起。例如:10 - 10% 20 - 20% ... 100 - 100% ... 400 - 400%)
public short getTopRow()
public short getLeftCol()
getLeftCol
in interface
Sheet
(接口表中的 getLeftCol)
public void showInPane(int topRow, int leftCol)
showInPane
in interface
Sheet
(界面工作表中的 showInPane)
topRow
- the top row to show in desktop window pane
(topRow - 在桌面窗口窗格中显示的第一行)
leftCol
- the left column to show in desktop window pane
(leftCol - 要在桌面窗口窗格中显示的左列)
protected void shiftMerged(int startRow, int endRow, int n, boolean isRow)
RowShifter.shiftMergedRegions(int, int, int)
.
startRow
- the start-index of the rows to shift, zero-based
(startRow - 要移动的行的起始索引,从零开始)
endRow
- the end-index of the rows to shift, zero-based
(endRow - 要移动的行的结束索引,从零开始)
n
- how far to shift, negative to shift up
(n - 移动多远,负数向上移动)
isRow
- unused, kept for backwards compatibility
(isRow - 未使用,为向后兼容而保留)
public void shiftRows(int startRow, int endRow, int n)
Calls shiftRows(startRow, endRow, n, false, false);
Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted).
(在 startRow 和 endRow 之间移动行 n 行。如果您使用负数,它将向上移动行。代码确保行不会环绕。调用 shiftRows(startRow, endRow, n, false, false);另外移动在这些行中完全定义的合并区域(即,在要移动的行上合并 2 个单元格)。)public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)
Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted). All merged regions that are completely overlaid by shifting will be deleted.
TODO Might want to add bounds checking here
(在 startRow 和 endRow 之间移动行 n 行。如果您使用负数,它将向上移动行。代码确保行不会环绕另外移动在这些行中完全定义的合并区域(即,在要移动的行上合并 2 个单元格)。所有被移位完全覆盖的合并区域将被删除。 TODO 可能想在此处添加边界检查)shiftRows
in interface
Sheet
(界面工作表中的 shiftRows)
startRow
- the row to start shifting
(startRow - 开始移动的行)
endRow
- the row to end shifting
(endRow - 结束移位的行)
n
- the number of rows to shift
(n - 要移动的行数)
copyRowHeight
- whether to copy the row height during the shift
(copyRowHeight - 是否在班次期间复制行高)
resetOriginalRowHeight
- whether to set the original row's height to the default
(resetOriginalRowHeight - 是否将原始行的高度设置为默认值)
public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight, boolean moveComments)
Additionally shifts merged regions that are completely defined in these rows (ie. merged 2 cells on a row to be shifted).
TODO Might want to add bounds checking here
(在 startRow 和 endRow 之间移动行 n 行。如果您使用负数,它将向上移动行。代码确保行不会环绕另外移动在这些行中完全定义的合并区域(即,在要移动的行上合并 2 个单元格)。 TODO 可能想在此处添加边界检查)startRow
- the row to start shifting
(startRow - 开始移动的行)
endRow
- the row to end shifting
(endRow - 结束移位的行)
n
- the number of rows to shift
(n - 要移动的行数)
copyRowHeight
- whether to copy the row height during the shift
(copyRowHeight - 是否在班次期间复制行高)
resetOriginalRowHeight
- whether to set the original row's height to the default
(resetOriginalRowHeight - 是否将原始行的高度设置为默认值)
moveComments
- whether to move comments at the same time as the cells they are attached to
(moveComments - 是否在它们附加到的单元格的同时移动评论)
@Beta public void shiftColumns(int startColumn, int endColumn, int n)
shiftColumns
in interface
Sheet
(界面工作表中的 shiftColumns)
startColumn
- the column to start shifting
(startColumn - 开始移动的列)
endColumn
- the column to end shifting
(endColumn - 结束移位的列)
n
- the number of columns to shift
(n - 要移动的列数)
protected void insertChartRecords(java.util.List<Record> records)
public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)
If both colSplit and rowSplit are zero then the existing freeze pane is removed
(创建一个拆分(冻结窗格)。任何现有的冻结窗格或拆分窗格都会被覆盖。如果 colSplit 和 rowSplit 都为零,则删除现有的冻结窗格)createFreezePane
in interface
Sheet
(界面Sheet中的createFreezePane)
colSplit
- Horizonatal position of split.
(colSplit - 分割的水平位置。)
rowSplit
- Vertical position of split.
(rowSplit - 拆分的垂直位置。)
leftmostColumn
- Left column visible in right pane.
(leftmostColumn - 在右窗格中可见的左列。)
topRow
- Top row visible in bottom pane
(topRow - 在底部窗格中可见的顶行)
public void createFreezePane(int colSplit, int rowSplit)
If both colSplit and rowSplit are zero then the existing freeze pane is removed
(创建一个拆分(冻结窗格)。任何现有的冻结窗格或拆分窗格都会被覆盖。如果 colSplit 和 rowSplit 都为零,则删除现有的冻结窗格)createFreezePane
in interface
Sheet
(界面Sheet中的createFreezePane)
colSplit
- Horizonatal position of split.
(colSplit - 分割的水平位置。)
rowSplit
- Vertical position of split.
(rowSplit - 拆分的垂直位置。)
public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)
createSplitPane
in interface
Sheet
(界面Sheet中的createSplitPane)
xSplitPos
- Horizonatal position of split (in 1/20th of a point).
(xSplitPos - 分割的水平位置(点的 1/20)。)
ySplitPos
- Vertical position of split (in 1/20th of a point).
(ySplitPos - 分割的垂直位置(点的 1/20)。)
topRow
- Top row visible in bottom pane
(topRow - 在底部窗格中可见的顶行)
leftmostColumn
- Left column visible in right pane.
(leftmostColumn - 在右窗格中可见的左列。)
activePane
- Active pane. One of: PANE_LOWER_RIGHT, PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
(activePane - 活动窗格。以下之一:PANE_LOWER_RIGHT、PANE_UPPER_RIGHT、PANE_LOWER_LEFT、PANE_UPPER_LEFT)
Sheet.PANE_LOWER_LEFT
,
Sheet.PANE_LOWER_RIGHT
,
Sheet.PANE_UPPER_LEFT
,
Sheet.PANE_UPPER_RIGHT
public PaneInformation getPaneInformation()
getPaneInformation
in interface
Sheet
(界面Sheet中的getPaneInformation)
public void setDisplayGridlines(boolean show)
setDisplayGridlines
in interface
Sheet
(界面Sheet中的setDisplayGridlines)
show
- whether to show gridlines or not
(show - 是否显示网格线)
public boolean isDisplayGridlines()
isDisplayGridlines
in interface
Sheet
(界面表中的 isDisplayGridlines)
public void setDisplayFormulas(boolean show)
setDisplayFormulas
in interface
Sheet
(界面表中的 setDisplayFormulas)
show
- whether to show formulas or not
(show - 是否显示公式)
public boolean isDisplayFormulas()
isDisplayFormulas
in interface
Sheet
(界面表中的 isDisplayFormulas)
public void setDisplayRowColHeadings(boolean show)
setDisplayRowColHeadings
in interface
Sheet
(界面表中的 setDisplayRowColHeadings)
show
- whether to show RowColHeadings or not
(show - 是否显示 RowColHeadings)
public boolean isDisplayRowColHeadings()
isDisplayRowColHeadings
in interface
Sheet
(界面表中的 isDisplayRowColHeadings)
public void setRowBreak(int row)
For example, sheet.setColumnBreak(2);
breaks the sheet into two parts with columns A,B,C in the first and D,E,... in the second. Simuilar, sheet.setRowBreak(2);
breaks the sheet into two parts with first three rows (rownum=1...3) in the first part and rows starting with rownum=4 in the second.
setRowBreak
in interface
Sheet
(接口表中的 setRowBreak)
row
- the row to break, inclusive
(row - 要中断的行,包括)
public boolean isRowBroken(int row)
Sheet
isRowBroken
in interface
Sheet
(isRowBroken 在接口表中)
row
- FIXME: Document this!
(行 - FIXME:记录这个!)
true
if there is a page break at the indicated row
(如果在指示的行有分页符,则为 true)
public void removeRowBreak(int row)
removeRowBreak
in interface
Sheet
(接口表中的 removeRowBreak)
row
- The 0-based index of the row.
(row - 行的从 0 开始的索引。)
public int[] getRowBreaks()
Sheet
getRowBreaks
in interface
Sheet
(接口表中的 getRowBreaks)
null
(所有水平分页符的行索引,从不为空)
public int[] getColumnBreaks()
Sheet
getColumnBreaks
in interface
Sheet
(接口表中的 getColumnBreaks)
null
(所有垂直分页符的列索引,从不为空)
public void setColumnBreak(int column)
For example, sheet.setColumnBreak(2);
breaks the sheet into two parts with columns A,B,C in the first and D,E,... in the second. Simuilar, sheet.setRowBreak(2);
breaks the sheet into two parts with first three rows (rownum=1...3) in the first part and rows starting with rownum=4 in the second.
setColumnBreak
in interface
Sheet
(接口表中的 setColumnBreak)
column
- the column to break, inclusive
(column - 要中断的列,包括)
public boolean isColumnBroken(int column)
isColumnBroken
in interface
Sheet
(isColumnBroken 在接口表中)
column
- FIXME: Document this!
(专栏 - FIXME:记录这个!)
public void removeColumnBreak(int column)
removeColumnBreak
in interface
Sheet
(界面表中的 removeColumnBreak)
column
- The index of the column for which to remove a page-break, zero-based
(column - 要删除分页符的列的索引,从零开始)
protected void validateRow(int row)
row
- the index of the row to validate, zero-based
(row - 要验证的行的索引,从零开始)
protected void validateColumn(int column)
column
- the index of the column to validate, zero-based
(column - 要验证的列的索引,从零开始)
public void dumpDrawingRecords(boolean fat, java.io.PrintWriter pw)
public EscherAggregate getDrawingEscherAggregate()
public HSSFPatriarch getDrawingPatriarch()
getDrawingPatriarch
in interface
Sheet
(界面Sheet中的getDrawingPatriarch)
public HSSFPatriarch createDrawingPatriarch()
This may then be used to add graphics or charts.
Note that this will normally have the effect of removing any existing drawings on this sheet.
(创建顶级图形族长。然后可以使用它来添加图形或图表。请注意,这通常会删除此工作表上的任何现有图纸。)createDrawingPatriarch
in interface
Sheet
(界面Sheet中的createDrawingPatriarch)
public void setColumnGroupCollapsed(int columnNumber, boolean collapsed)
setColumnGroupCollapsed
in interface
Sheet
(界面Sheet中的setColumnGroupCollapsed)
columnNumber
- One of the columns in the group.
(columnNumber - 组中的列之一。)
collapsed
- true = collapse group, false = expand group.
(折叠 - true = 折叠组,false = 展开组。)
public void groupColumn(int fromColumn, int toColumn)
groupColumn
in interface
Sheet
(界面Sheet中的groupColumn)
fromColumn
- beginning of the column range.
(fromColumn - 列范围的开始。)
toColumn
- end of the column range.
(toColumn - 列范围的结尾。)
public void ungroupColumn(int fromColumn, int toColumn)
Sheet
ungroupColumn
in interface
Sheet
(界面Sheet中的ungroupColumn)
fromColumn
- start column (0-based)
(fromColumn - 起始列(从 0 开始))
toColumn
- end column (0-based)
(toColumn - 结束列(从 0 开始))
public void groupRow(int fromRow, int toRow)
public void ungroupRow(int fromRow, int toRow)
Sheet
ungroupRow
in interface
Sheet
(界面表中的 ungroupRow)
fromRow
- start row (0-based)
(fromRow - 起始行(从 0 开始))
toRow
- end row (0-based)
(toRow - 结束行(从 0 开始))
public void setRowGroupCollapsed(int rowIndex, boolean collapse)
Sheet
setRowGroupCollapsed
in interface
Sheet
(界面Sheet中的setRowGroupCollapsed)
rowIndex
- start row of a grouped range of rows (0-based)
(rowIndex - 一组行的起始行(从 0 开始))
collapse
- whether to expand/collapse the detail rows
(折叠 - 是否展开/折叠详细信息行)
public void setDefaultColumnStyle(int column, CellStyle style)
setDefaultColumnStyle
in interface
Sheet
(界面表中的 setDefaultColumnStyle)
column
- the column index
(column - 列索引)
style
- the style to set
(style - 要设置的样式)
public void autoSizeColumn(int column)
This process can be relatively slow on large sheets, so this should normally only be called once per column, at the end of your processing.
(调整列宽以适合内容。此过程在大型工作表上可能相对较慢,因此通常应在处理结束时每列调用一次。)autoSizeColumn
in interface
Sheet
(接口表中的 autoSizeColumn)
column
- the column index
(column - 列索引)
public void autoSizeColumn(int column, boolean useMergedCells)
This process can be relatively slow on large sheets, so this should normally only be called once per column, at the end of your processing.
You can specify whether the content of merged cells should be considered or ignored. Default is to ignore merged cells.
(调整列宽以适合内容。此过程在大型工作表上可能相对较慢,因此通常在处理结束时每列只调用一次。您可以指定是否应考虑或忽略合并单元格的内容。默认是忽略合并的单元格。)autoSizeColumn
in interface
Sheet
(接口表中的 autoSizeColumn)
column
- the column index
(column - 列索引)
useMergedCells
- whether to use the contents of merged cells when calculating the width of the column
(useMergedCells - 计算列宽时是否使用合并单元格的内容)
public HSSFComment getCellComment(CellAddress ref)
getCellComment
in interface
Sheet
(接口表中的getCellComment)
null
if not found
(单元格注释或 null 如果未找到)
public HSSFHyperlink getHyperlink(int row, int column)
getHyperlink
in interface
Sheet
(接口表中的getHyperlink)
row
- The index of the row of the hyperlink, zero-based
(row - 超链接行的索引,从零开始)
column
- the index of the column of the hyperlink, zero-based
(column - 超链接列的索引,从零开始)
public HSSFHyperlink getHyperlink(CellAddress addr)
getHyperlink
in interface
Sheet
(接口表中的getHyperlink)
addr
- The address of the cell containing the hyperlink
(addr - 包含超链接的单元格的地址)
addr
; otherwise returns
null
(超链接,如果有一个超链接锚定在 addr;否则返回 null)
public java.util.List<HSSFHyperlink> getHyperlinkList()
getHyperlinkList
in interface
Sheet
(接口Sheet中的getHyperlinkList)
protected void removeHyperlink(HSSFHyperlink link)
link
- the HSSFHyperlink wrapper around the HyperlinkRecord to remove
(link - 要删除的 HyperlinkRecord 周围的 HSSFHyperlink 包装器)
protected void removeHyperlink(HyperlinkRecord link)
link
- the underlying HyperlinkRecord to remove from this sheet
(link - 要从此工作表中删除的基础 HyperlinkRecord)
public HSSFSheetConditionalFormatting getSheetConditionalFormatting()
Sheet
getSheetConditionalFormatting
in interface
Sheet
(接口Sheet中的getSheetConditionalFormatting)
public java.lang.String getSheetName()
getSheetName
in interface
Sheet
(接口Sheet中的getSheetName)
public CellRange<HSSFCell> setArrayFormula(java.lang.String formula, CellRangeAddress range)
Sheet
Note if there are shared formulas this will invalidate any FormulaEvaluator
instances based on this workbook
setArrayFormula
in interface
Sheet
(接口表中的 setArrayFormula)
formula
- text representation of the formula
(公式 - 公式的文本表示)
range
- Region of array formula for result.
(range - 结果的数组公式区域。)
CellRange
of cells affected by this change
(受此更改影响的单元格的 CellRange)
public CellRange<HSSFCell> removeArrayFormula(Cell cell)
Sheet
removeArrayFormula
in interface
Sheet
(接口表中的 removeArrayFormula)
cell
- any cell within Array Formula range
(单元格 - 数组公式范围内的任何单元格)
CellRange
of cells affected by this change
(受此更改影响的单元格的 CellRange)
public DataValidationHelper getDataValidationHelper()
getDataValidationHelper
in interface
Sheet
(接口表中的 getDataValidationHelper)
public HSSFAutoFilter setAutoFilter(CellRangeAddress range)
Sheet
setAutoFilter
in interface
Sheet
(界面Sheet中的setAutoFilter)
range
- the range of cells to filter
(range - 要过滤的单元格范围)
protected HSSFComment findCellComment(int row, int column)
public java.util.Map<CellAddress,HSSFComment> getCellComments()
getCellComments
in interface
Sheet
(接口表中的getCellComments)
public CellRangeAddress getRepeatingRows()
Sheet
Repeating rows cover a range of contiguous rows, e.g.:
Sheet1!$1:$1 Sheet2!$5:$8The
CellRangeAddress
returned contains a column part which spans all columns, and a row part which specifies the contiguous range of repeating rows.
If the Sheet does not have any repeating rows defined, null is returned.
(获取打印工作表时使用的重复行,如 File->PageSetup->Sheet 中所示。重复行覆盖一系列连续行,例如: Sheet1!$1:$1 Sheet2!$5:$8 返回的 CellRangeAddress 包含一个跨所有列的列部分和一个指定重复行的连续范围的行部分。如果工作表没有定义任何重复行,则返回 null。)getRepeatingRows
in interface
Sheet
(接口表中的 getRepeatingRows)
CellRangeAddress
containing the repeating rows for the Sheet, or null.
(包含工作表的重复行的 CellRangeAddress,或 null。)
public CellRangeAddress getRepeatingColumns()
Sheet
Repeating columns cover a range of contiguous columns, e.g.:
Sheet1!$A:$A Sheet2!$C:$FThe
CellRangeAddress
returned contains a row part which spans all rows, and a column part which specifies the contiguous range of repeating columns.
If the Sheet does not have any repeating columns defined, null is returned.
(获取打印工作表时使用的重复列,如 File->PageSetup->Sheet 中所示。重复列覆盖一系列连续列,例如: Sheet1!$A:$A Sheet2!$C:$F 返回的 CellRangeAddress 包含一个跨越所有行的行部分和一个指定重复列的连续范围的列部分。如果工作表没有定义任何重复的列,则返回 null。)getRepeatingColumns
in interface
Sheet
(接口表中的 getRepeatingColumns)
CellRangeAddress
containing the repeating columns for the Sheet, or null.
(包含工作表的重复列的 CellRangeAddress,或 null。)
public void setRepeatingRows(CellRangeAddress rowRangeRef)
Sheet
Repeating rows cover a range of contiguous rows, e.g.:
Sheet1!$1:$1 Sheet2!$5:$8The parameter
CellRangeAddress
should specify a column part which spans all columns, and a row part which specifies the contiguous range of repeating rows, e.g.:
sheet.setRepeatingRows(CellRangeAddress.valueOf("2:3"));A null parameter value indicates that repeating rows should be removed from the Sheet:
sheet.setRepeatingRows(null);(设置打印工作表时使用的重复行,如 File->PageSetup->Sheet 中所示。重复行覆盖一系列连续行,例如:Sheet1!$1:$1 Sheet2!$5:$8 参数 CellRangeAddress 应指定跨越所有列的列部分,以及指定重复行的连续范围的行部分,例如:sheet .setRepeatingRows(CellRangeAddress.valueOf("2:3"));空参数值表示应从工作表中删除重复行: sheet.setRepeatingRows(null);)
setRepeatingRows
in interface
Sheet
(接口表中的 setRepeatingRows)
rowRangeRef
- a
CellRangeAddress
containing the repeating rows for the Sheet, or null.
(rowRangeRef - 包含工作表的重复行的 CellRangeAddress,或 null。)
public void setRepeatingColumns(CellRangeAddress columnRangeRef)
Sheet
Repeating columns cover a range of contiguous columns, e.g.:
Sheet1!$A:$A Sheet2!$C:$FThe parameter
CellRangeAddress
should specify a row part which spans all rows, and a column part which specifies the contiguous range of repeating columns, e.g.:
sheet.setRepeatingColumns(CellRangeAddress.valueOf("B:C"));A null parameter value indicates that repeating columns should be removed from the Sheet:
sheet.setRepeatingColumns(null);(设置打印工作表时使用的重复列,如 File->PageSetup->Sheet 中所示。重复列覆盖一系列连续列,例如: Sheet1!$A:$A Sheet2!$C:$F 参数 CellRangeAddress 应指定跨越所有行的行部分,以及指定重复列的连续范围的列部分,例如: sheet.setRepeatingColumns(CellRangeAddress.valueOf("B:C"));空参数值表示应从工作表中删除重复列: sheet.setRepeatingColumns(null);)
setRepeatingColumns
in interface
Sheet
(界面表中的 setRepeatingColumns)
columnRangeRef
- a
CellRangeAddress
containing the repeating columns for the Sheet, or null.
(columnRangeRef - 包含工作表的重复列的 CellRangeAddress,或 null。)
public int getColumnOutlineLevel(int columnIndex)
getColumnOutlineLevel
in interface
Sheet
(接口表中的getColumnOutlineLevel)
public CellAddress getActiveCell()
A1
.
(返回活动单元格的位置,例如 A1。)
getActiveCell
in interface
Sheet
(接口表中的getActiveCell)
public void setActiveCell(CellAddress address)
setActiveCell
in interface
Sheet
(接口表中的 setActiveCell)
address
- the location of the active cell, e.g.
A1
.
(地址 - 活动单元的位置,例如 A1。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.