public class ExcelFacade
extends java.lang.Object
Example 1:
final byte[] data = ExcelWriter
.createXlsx()
.withSheet("Persons", Person.class)
.withColumn("FirstName", Person::getFirstName)
.withColumn("LastName", Person::getLastName)
.withColumn("Age", Person::getAge)
.renderData(persons())
.autoSizeColumns()
.end()
.writeToBytes();
Example 2 (header row format):
final byte[] data = ExcelWriter
.createXlsx()
.withFont("bold").bold().end()
.withFont("italic").italic().end()
.withCellStyle("header").font("bold").end()
.withSheet("Persons", Person.class)
.defaultHeaderStyle("header")
.withColumn("FirstName", Person::getFirstName)
.withColumn("LastName", Person::getLastName)
.withColumn("Age", Person::getAge)
.renderData(persons)
.renderData(getQueryStatistics())
.autoSizeColumns()
.end()
.writeToBytes();
Example 3 (footer SUM):
final List<DataRecord> persons = persons();
final byte[] data = ExcelWriter
.createXlsx()
.withSheet("Persons", Person.class)
.withColumn("FirstName")
.colMapper(Person::getFirstName)
.footerTextValue("SUM age")
.end()
.withColumn("LastName")
.colMapper(Person::getLastName)
.end()
.withColumn("Age")
.colMapper(Person::getAge)
.footerSum()
.end()
.renderData(persons)
.autoSizeColumns()
.end()
.writeToBytes();
Example 4 (footer SUM with styles):
final List<DataRecord> persons = persons();
final byte[] data = ExcelWriter
.createXlsx()
.withFont("bold").bold().end()
.withFont("bold-blue").bold().color(IndexedColors.BLUE).end()
.withCellStyle("header").font("bold").bgColor(IndexedColors.GREY_25_PERCENT).end()
.withCellStyle("age").format("#,##0").end()
.withCellStyle("sum-header").font("bold").end()
.withCellStyle("sum-age").font("bold-blue").format("#,##0").end()
.withSheet("Persons", Person.class)
.defaultHeaderStyle("header")
.withColumn("FirstName")
.colMapper(Person::getFirstName)
.footerTextValue("SUM age")
.footerStyle("sum-header")
.end()
.withColumn("LastName")
.colMapper(Person::getLastName)
.end()
.withColumn("Age")
.colMapper(Person::getAge)
.bodyStyle("age")
.footerSum()
.footerStyle("sum-age")
.end()
.renderData(persons)
.autoSizeColumns()
.end()
.writeToBytes();
| Constructor and Description |
|---|
ExcelFacade(com.github.jlangch.venice.impl.util.excel.Excel excel) |
| Modifier and Type | Method and Description |
|---|---|
static ExcelFacade |
createXls() |
static ExcelFacade |
createXlsx() |
ExcelFacade |
end() |
void |
evaluateAllFormulas() |
int |
getNumberOfSheets() |
<T> ExcelSheetFacade<T> |
getSheet(java.lang.String name) |
<T> ExcelSheetFacade<T> |
getSheetAt(int sheetIdx) |
static ExcelFacade |
open(byte[] document) |
static ExcelFacade |
open(java.nio.ByteBuffer document) |
static ExcelFacade |
open(java.io.File file) |
static ExcelFacade |
open(java.io.InputStream is) |
com.github.jlangch.venice.impl.util.excel.Excel |
toExcel() |
ExcelCellStyleBuilder |
withCellStyle(java.lang.String name) |
ExcelFontBuilder |
withFont(java.lang.String name) |
<T> ExcelSheetFacade<T> |
withSheet(java.lang.String name,
java.lang.Class<T> type) |
void |
write(java.io.File file) |
void |
write(java.io.OutputStream outputStream) |
byte[] |
writeToBytes() |
public ExcelFacade(com.github.jlangch.venice.impl.util.excel.Excel excel)
public static ExcelFacade open(byte[] document)
public static ExcelFacade open(java.nio.ByteBuffer document)
public static ExcelFacade open(java.io.File file)
public static ExcelFacade open(java.io.InputStream is)
public static ExcelFacade createXls()
public static ExcelFacade createXlsx()
public int getNumberOfSheets()
public void evaluateAllFormulas()
public ExcelFontBuilder withFont(java.lang.String name)
public ExcelCellStyleBuilder withCellStyle(java.lang.String name)
public <T> ExcelSheetFacade<T> withSheet(java.lang.String name, java.lang.Class<T> type)
public void write(java.io.File file)
public void write(java.io.OutputStream outputStream)
public byte[] writeToBytes()
public ExcelFacade end()
public <T> ExcelSheetFacade<T> getSheet(java.lang.String name)
public <T> ExcelSheetFacade<T> getSheetAt(int sheetIdx)
public com.github.jlangch.venice.impl.util.excel.Excel toExcel()