public class Worksheet extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
MAX_COL_WIDTH
Maximum column width in Excel.
|
static int |
MAX_COLS
Maximum number of columns in Excel.
|
static int |
MAX_ROWS
Maximum number of rows in Excel.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
finish() |
void |
flush()
Finish the construction of this worksheet.
|
void |
formula(int r,
int c,
String expression)
Set the cell formula at the given coordinates.
|
String |
getName()
Get worksheet name.
|
Workbook |
getWorkbook()
Get parent workbook.
|
void |
hideRow(int row)
Hide the given row.
|
Range |
range(int top,
int left,
int bottom,
int right)
Create a new range of cells.
|
void |
showRow(int row)
Show the given row.
|
StyleSetter |
style(int r,
int c)
Get a new style setter for a cell.
|
Object |
value(int r,
int c)
Get the cell value (or formula) at the given coordinates.
|
void |
value(int r,
int c,
Object value)
Set the cell value at the given coordinates.
|
void |
width(int c,
double width)
Specify the width for the given column.
|
public static final int MAX_ROWS
public static final int MAX_COLS
public static final int MAX_COL_WIDTH
public String getName()
public Workbook getWorkbook()
public void hideRow(int row)
row - Zero-based row numberpublic void showRow(int row)
row - Zero-based row numberpublic void width(int c,
double width)
The maximum column width in excel is 255. The colum width in excel is the number of characters that can be displayed with the standard font (first font in the workbook).
Note: The xml spec specifies additional padding for each cell (Section 3.3.1.12 of the OOXML spec) which will result in slightly less characters being displayed then what is given here.
c - Zero-based column numberwidth - The width of the column in character widthspublic void value(int r,
int c,
Object value)
r - Zero-based row number.c - Zero-based column number.value - Cell value. Supported types are
String, Date, LocalDate, LocalDateTime, ZonedDateTime
and Number implementations. Note Excel timestamps do not carry
any timezone information; Date values are converted to an Excel
serial number with the system timezone. If you need a specific timezone,
prefer passing a ZonedDateTime.public Object value(int r, int c)
r - Zero-based row number.c - Zero-based column number.Formula).public void formula(int r,
int c,
String expression)
r - Zero-based row number.c - Zero-based column number.expression - Cell formula expression.public StyleSetter style(int r, int c)
r - Zero-based row number.c - Zero-based column number.public Range range(int top, int left, int bottom, int right)
top <= bottom and left <=
right.top - Top row.left - Left column.bottom - Bottom row.right - Right column.public void flush()
throws IOException
IOException - If an I/O error occurs.public void finish()
throws IOException
IOExceptionCopyright © 2021. All rights reserved.