- java.lang.Object
-
- org.dhatim.fastexcel.Workbook
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class Workbook extends Object implements Closeable
-
-
Constructor Summary
Constructors Constructor Description Workbook(OutputStream os, String applicationName, String applicationVersion)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
finish()
Complete workbook generation: this writes worksheets and additional files as zip entries to the output stream.Worksheet
newWorksheet(String name)
Create a new worksheet in this workbook.Properties
properties()
void
setActiveTab(int tabIndex)
void
setCompressionLevel(int level)
Sets the compression level of the xlsx.void
setGlobalDefaultFont(String fontName, double fontSize)
void
setGlobalDefaultFont(org.dhatim.fastexcel.Font font)
void
sortWorksheets(Comparator<Worksheet> comparator)
Sort the current worksheets with the given Comparator
-
-
-
Constructor Detail
-
Workbook
public Workbook(OutputStream os, String applicationName, String applicationVersion)
Constructor.- Parameters:
os
- Output stream eventually holding the serialized workbook.applicationName
- Name of the application which generated this workbook.applicationVersion
- Version of the application. Ignored ifnull
. Refer to this page for details.
-
-
Method Detail
-
setCompressionLevel
public void setCompressionLevel(int level)
Sets the compression level of the xlsx. An xlsx file is a standard zip archive consisting of xml files. Default compression is 4.- Parameters:
level
- the compression level (0-9)
-
setActiveTab
public void setActiveTab(int tabIndex)
-
setGlobalDefaultFont
public void setGlobalDefaultFont(String fontName, double fontSize)
-
setGlobalDefaultFont
public void setGlobalDefaultFont(org.dhatim.fastexcel.Font font)
-
properties
public Properties properties()
-
sortWorksheets
public void sortWorksheets(Comparator<Worksheet> comparator)
Sort the current worksheets with the given Comparator- Parameters:
comparator
- The Comparator used to sort the worksheets
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
finish
public void finish() throws IOException
Complete workbook generation: this writes worksheets and additional files as zip entries to the output stream.- Throws:
IOException
- In case of I/O error.
-
-