Package csv.impl

Class XExcelWriter

All Implemented Interfaces:
TableWriter

public class XExcelWriter extends ExcelWriter
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:
  • 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

      public XExcelWriter(OutputStream out)
      Constructor with defined output stream. A new workbook will be created.
      Parameters:
      out - output stream to be used.
    • XExcelWriter

      public XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook, OutputStream out)
      Constructor with existing workbook and defined output stream.
      Parameters:
      workbook - the workbook to be used
      out - output stream to be used
    • XExcelWriter

      public XExcelWriter(File file) throws IOException
      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

      public XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook, File file) throws IOException
      Constructor with existing workbook that needs to be written to a file.
      Parameters:
      workbook - the workbook to be used
      file - output file to be used
      Throws:
      IOException - when the file cannot be written to
    • XExcelWriter

      public XExcelWriter(String file) throws IOException
      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

      public XExcelWriter(org.apache.poi.ss.usermodel.Workbook workbook, String file) throws IOException
      Constructor with existing workbook that needs to be written to a file.
      Parameters:
      workbook - the workbook to be used
      file - 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:
      getWorkbook in class ExcelWriter
      Returns:
      the workbook