public class XMLWorksheetWriter extends Object implements IWorksheetWriter
| 限定符和类型 | 字段和说明 |
|---|---|
protected ExtBufferedWriter |
bw |
protected static char[] |
cacheChar
Char buffer
|
protected Column[] |
columns |
protected Comments |
comments |
protected Sheet |
sheet |
protected SharedStrings |
sst |
protected int |
startRow |
protected Path |
workSheetPath |
| 构造器和说明 |
|---|
XMLWorksheetWriter() |
XMLWorksheetWriter(Sheet sheet) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
afterSheetData()
Append others customize info
|
protected void |
beforeSheetDate(boolean nonHeader)
Begin to write the Sheet data and the header row.
|
IWorksheetWriter |
clone()
Clone
|
void |
close()
Release resources
|
int |
getColumnLimit()
The Worksheet column limit
|
int |
getRowLimit()
Override this method to modify the maximum number
of rows per page, this value contains the header
row and data rows
eq: limit is 100 means data has 99 rows
|
protected Path |
initWriter(Path root) |
protected void |
resizeColumnWidth(File path,
int rows)
Resize column width
|
IWorksheetWriter |
setWorksheet(Sheet sheet)
Rest worksheet
|
protected int |
startRow(int rows,
int columns)
Write begin of row
|
protected double |
stringWidth(String s,
int xf)
Calculate text width
FIXME reference
SwingUtilities2.stringWidth(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String) |
protected void |
writeAfter(int total)
Write at after worksheet body
|
protected void |
writeBefore()
Write worksheet header data
|
protected void |
writeBool(boolean bool,
int row,
int column,
int xf)
Write boolean value
|
protected void |
writeChar(char c,
int row,
int column,
int xf)
Write char value
|
protected void |
writeCols(int fillSpace,
String defaultWidth)
Write the default column info, The specified column width will be overwritten in these method.
|
protected void |
writeDecimal(BigDecimal bd,
int row,
int column,
int xf)
Write decimal value
|
protected void |
writeDecimalAutoSize(BigDecimal bd,
int row,
int column,
int xf)
Write decimal value and cache the max value
|
protected void |
writeDimension()
Write the dimension of sheet, default value is
A1 |
protected void |
writeDouble(double d,
int row,
int column,
int xf)
Write double value
|
protected void |
writeDoubleAutoSize(double d,
int row,
int column,
int xf)
Write double value and cache the max value
|
protected int |
writeHeaderRow()
Write the header row
|
protected void |
writeMergeCells()
Append merged cells if exists
|
protected void |
writeNull(int row,
int column,
int xf)
Write blank value
|
protected void |
writeNumeric(long l,
int row,
int column,
int xf)
Write numeric value
|
protected void |
writeNumericAutoSize(long l,
int row,
int column,
int xf)
Write numeric value and cache the max value
|
protected void |
writeRootNode()
Write the <worksheet> node
|
protected void |
writeRow(Row row)
Write a row data
|
protected void |
writeRowAutoSize(Row row)
Write a row data
|
protected void |
writeSheetFormat(int fillSpace,
String defaultWidth)
Write the sheet format
|
protected void |
writeSheetViews()
Write the sheet views such as FreezeEnum, Default selection cell.
|
protected void |
writeString(String s,
int row,
int column,
int xf)
Write string value
|
protected void |
writeStringAutoSize(String s,
int row,
int column,
int xf)
Write string value and cache the max string length
|
void |
writeTo(Path path)
Write a row block
|
void |
writeTo(Path path,
Supplier<RowBlock> supplier)
Write a row block
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisBigDecimal, isBool, isChar, isDate, isDateTime, isDouble, isFloat, isInt, isLocalDate, isLocalDateTime, isLocalTime, isLong, isShort, isString, isTime, outOfSheet, writeEmptySheetprotected Path workSheetPath
protected ExtBufferedWriter bw
protected Sheet sheet
protected Column[] columns
protected SharedStrings sst
protected Comments comments
protected int startRow
protected static char[] cacheChar
public XMLWorksheetWriter()
public XMLWorksheetWriter(Sheet sheet)
public void writeTo(Path path, Supplier<RowBlock> supplier) throws IOException
writeTo 在接口中 IWorksheetWritersupplier - a row-block supplierpath - the storage pathIOException - if I/O error occurpublic void writeTo(Path path) throws IOException
writeTo 在接口中 Storablepath - the storage pathIOException - if I/O error occurprotected Path initWriter(Path root) throws IOException
IOExceptionpublic IWorksheetWriter setWorksheet(Sheet sheet)
setWorksheet 在接口中 IWorksheetWritersheet - the worksheetpublic IWorksheetWriter clone()
IWorksheetWriterclone 在接口中 IWorksheetWriterclone 在类中 Objectpublic int getRowLimit()
eq: limit is 100 means data has 99 rows
getRowLimit 在接口中 IWorksheetWriterpublic int getColumnLimit()
getColumnLimit 在接口中 IWorksheetWriterprotected void writeBefore()
throws IOException
IOException - if I/O error occurprotected int writeHeaderRow()
throws IOException
IOException - if I/O error occurprotected void writeAfter(int total)
throws IOException
total - the total of rowsIOException - if I/O error occurprotected int startRow(int rows,
int columns)
throws IOException
rows - the row index (zero base)columns - the column lengthIOException - if I/O error occurprotected void writeRow(Row row) throws IOException
row - a row dataIOException - if I/O error occurprotected void writeRowAutoSize(Row row) throws IOException
row - a row dataIOException - if I/O error occurprotected void writeString(String s, int row, int column, int xf) throws IOException
s - the string valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeStringAutoSize(String s, int row, int column, int xf) throws IOException
s - the string valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeDouble(double d,
int row,
int column,
int xf)
throws IOException
d - the double valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeDoubleAutoSize(double d,
int row,
int column,
int xf)
throws IOException
d - the double valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeDecimal(BigDecimal bd, int row, int column, int xf) throws IOException
bd - the decimal valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeDecimalAutoSize(BigDecimal bd, int row, int column, int xf) throws IOException
bd - the decimal valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeChar(char c,
int row,
int column,
int xf)
throws IOException
c - the character valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeNumeric(long l,
int row,
int column,
int xf)
throws IOException
l - the numeric valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeNumericAutoSize(long l,
int row,
int column,
int xf)
throws IOException
l - the numeric valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeBool(boolean bool,
int row,
int column,
int xf)
throws IOException
bool - the boolean valuerow - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void writeNull(int row,
int column,
int xf)
throws IOException
row - the row indexcolumn - the column indexxf - the style indexIOException - if I/O error occurprotected void resizeColumnWidth(File path, int rows) throws IOException
path - the sheet temp pathrows - total of rowsIOException - if I/O error occurpublic void close()
close 在接口中 Closeableclose 在接口中 AutoCloseableprotected void writeRootNode()
throws IOException
IOException - if I/O error occur.protected void writeDimension()
throws IOException
A1IOException - if I/O error occur.protected void writeSheetViews()
throws IOException
IOException - if I/O error occur.protected void writeSheetFormat(int fillSpace,
String defaultWidth)
throws IOException
fillSpace - The number of characters to pad when recalculating the width.defaultWidth - The default cell width, 8.38 will be use if it not be setting.IOException - if I/O error occur.protected void writeCols(int fillSpace,
String defaultWidth)
throws IOException
fillSpace - The number of characters to pad when recalculating the width.defaultWidth - The default cell width, 8.38 will be use if it not be setting.IOException - if I/O error occur.protected void beforeSheetDate(boolean nonHeader)
throws IOException
nonHeader - mark none headerIOException - if I/O error occur.protected void afterSheetData()
throws IOException
IOException - if I/O error occur.protected void writeMergeCells()
throws IOException
IOException - if I/O error occur.protected double stringWidth(String s, int xf)
SwingUtilities2.stringWidth(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String)s - the string valuexf - the style indexCopyright © 2022. All rights reserved.