Package csv.impl
Class XExcelWriter
java.lang.Object
csv.impl.AbstractTableWriter
csv.impl.AbstractStreamTableWriter
csv.impl.ExcelWriter
csv.impl.XExcelWriter
- All Implemented Interfaces:
TableWriter
Provides ability to write XML-based Excel files.
The Excel will be written with a call to ExcelWriter.close() only!
Please notice that this implementation does not support writing formulas into
cells, yet.
Example:
java.io.File f = new java.io.File("excel-test.xlsx");
ExcelWriter out = new XExcelWriter(f);
out.printRow(new Object[] { "0:0", new Integer(3), new Date() });
out.printRow(new Object[] { "1:0", new Double(), "another String value" });
out.close();
- Author:
- RalphSchuster
- See Also:
-
Field Summary
Fields inherited from class csv.impl.ExcelWriter
workbook -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.XExcelWriter(File file) Constructor for writing into a file.XExcelWriter(OutputStream out) Constructor with defined output stream.XExcelWriter(String file) Constructor for writing into a file.XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook) Constructor with existing workbook.XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook, File file) Constructor with existing workbook that needs to be written to a file.XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook, OutputStream out) Constructor with existing workbook and defined output stream.XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook, String file) Constructor with existing workbook that needs to be written to a file. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.poi.ss.usermodel.WorkbookReturns the workbook or creates a fresh one.Methods inherited from class csv.impl.ExcelWriter
close, createSheet, createSheet, createSheet, getFormatter, getOrCreateCell, getOrCreateCell, getOrCreateRow, getSheet, notifyExcelListeners, printComment, printRow, printRow, registerExcelListener, selectSheet, selectSheet, setFormatter, setStyle, setValue, setValue, setValue, unregisterExcelListenerMethods inherited from class csv.impl.AbstractStreamTableWriter
createOutputStreamWriter, createWriter, getCharsetEncoder, getOutputStream, getWriter, setCharset, setCharset, setCharsetEncoder, setOutputStreamMethods inherited from class csv.impl.AbstractTableWriter
convert, getMapper, getRowCount, incrementRowCount, init, printComment, printRow, printRow, printRow, setMapper
-
Constructor Details
-
XExcelWriter
public XExcelWriter()Default constructor. Please, notice that you are required to set the output stream before closing the writer.- See Also:
-
XExcelWriter
public XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook) Constructor with existing workbook. You can use this constructor if you wanna write to an existing workbook. Please, notice that you are required to set the output stream before closing the writer.- Parameters:
workbook- the workbook to be used- See Also:
-
XExcelWriter
Constructor with defined output stream. A new workbook will be created.- Parameters:
out- output stream to be used.
-
XExcelWriter
Constructor with existing workbook and defined output stream.- Parameters:
workbook- the workbook to be usedout- output stream to be used
-
XExcelWriter
Constructor for writing into a file. A new workbook will be created.- Parameters:
file- output file to be used- Throws:
IOException- when the file cannot be written to
-
XExcelWriter
Constructor with existing workbook that needs to be written to a file.- Parameters:
workbook- the workbook to be usedfile- output file to be used- Throws:
IOException- when the file cannot be written to
-
XExcelWriter
Constructor for writing into a file. A new workbook will be created.- Parameters:
file- output file to be used- Throws:
IOException- when the file cannot be written to
-
XExcelWriter
Constructor with existing workbook that needs to be written to a file.- Parameters:
workbook- the workbook to be usedfile- output file to be used- Throws:
IOException- when the file cannot be written to
-
-
Method Details
-
getWorkbook
public org.apache.poi.ss.usermodel.Workbook getWorkbook()Returns the workbook or creates a fresh one.- Overrides:
getWorkbookin classExcelWriter- Returns:
- the workbook
-