public class ExcelBuilder extends Object implements IExcelBuilder
(or a copy in /doc)
Modifier and Type | Class and Description |
---|---|
static class |
ExcelBuilder.Type |
Modifier and Type | Field and Description |
---|---|
static boolean |
CRASH_ON_CELL_OVERFLOW
States if the builder should throw an IllegalArgumentException or simply warn with a log once a cell index exceed
max number of columns or row.
|
static int |
LAST_COLUMN |
static int |
LAST_ROW |
static int |
MAX_COLUMN
The max number of columns supported by an excel sheet (256="IV" column header)
|
static int |
MAX_ROW
The max number of rows supported by an excel sheet
|
Constructor and Description |
---|
ExcelBuilder() |
ExcelBuilder(ExcelBuilder.Type type) |
ExcelBuilder(ExcelBuilder.Type type,
String firstSheet) |
Modifier and Type | Method and Description |
---|---|
org.apache.poi.ss.usermodel.Comment |
addComment(org.apache.poi.ss.usermodel.Cell cell,
String text,
int row,
int col,
int colWidth,
int rowHeight) |
org.apache.poi.ss.usermodel.Comment |
buildComment(String text,
int row,
int col,
int colWidth,
int rowHeight)
Return a Comment.
|
Collection<org.apache.poi.ss.usermodel.Sheet> |
getAllSheets() |
org.apache.poi.ss.usermodel.Font |
getBoldFont() |
org.apache.poi.hssf.util.HSSFColor |
getColor(byte r,
byte g,
byte b) |
org.apache.poi.hssf.util.HSSFColor |
getColor(ByteColor color) |
org.apache.poi.ss.usermodel.Sheet |
getCurrentSheet() |
int |
getCurrentSheetId() |
org.apache.poi.hssf.usermodel.HSSFWorkbook |
getHSSFWorkbook() |
org.apache.poi.ss.usermodel.Workbook |
getWorkbook() |
org.apache.poi.ss.usermodel.Workbook |
load(File file) |
org.apache.poi.ss.usermodel.Workbook |
load(String file) |
int |
loadPicture(String image) |
void |
mergeRange(int firstRow,
int firstColumn,
int lastRow,
int lastColumn) |
org.apache.poi.ss.usermodel.CellStyle |
newCellStyle()
Return a new cell style instance for the choosen workbook
ExcelBuilder.Type . |
org.apache.poi.ss.usermodel.CellStyle |
newColoredCellStyle(ByteColor color) |
org.apache.poi.ss.usermodel.Font |
newFont() |
org.apache.poi.ss.usermodel.Font |
newFont(int size) |
int |
newSheet(int index,
String name) |
void |
save(File file) |
void |
save(String file) |
org.apache.poi.ss.usermodel.Cell |
setCell(int row,
int column,
String content)
Set a cell text content with no styling information.
|
org.apache.poi.ss.usermodel.Cell |
setCell(int row,
int column,
String content,
org.apache.poi.ss.usermodel.CellStyle style)
Set a cell content at the given indices, and apply the style if it is not null.
|
void |
setColumnWidth(int column,
int width)
Set the width (in units of 1/256th of a character width)
|
void |
setColumnWidthAuto(int column) |
void |
setCurrentSheetId(int s) |
void |
setFreezePane(int colSplit,
int rowSplit) |
void |
setFreezePane(int colSplit,
int rowSplit,
int leftmostColumn,
int topRow) |
void |
setPicture(int pictureIdx,
int col1,
int row1,
boolean resize) |
void |
setRowHeight(int row,
int height) |
void |
setSplitPane(int xSplitPos,
int ySplitPos,
int leftmostColumn,
int topRow,
int activePane) |
public static int MAX_COLUMN
public static int MAX_ROW
public static int LAST_COLUMN
public static int LAST_ROW
public static boolean CRASH_ON_CELL_OVERFLOW
public ExcelBuilder()
public ExcelBuilder(ExcelBuilder.Type type)
public ExcelBuilder(ExcelBuilder.Type type, String firstSheet)
public org.apache.poi.ss.usermodel.Workbook getWorkbook()
getWorkbook
in interface IExcelBuilder
public org.apache.poi.hssf.usermodel.HSSFWorkbook getHSSFWorkbook()
public org.apache.poi.ss.usermodel.Cell setCell(int row, int column, String content, org.apache.poi.ss.usermodel.CellStyle style)
setCell
in interface IExcelBuilder
row
- row indexcolumn
- column indexcontent
- a string to display in the cellstyle
- a style to apply to the cellpublic org.apache.poi.ss.usermodel.Cell setCell(int row, int column, String content)
setCell
in interface IExcelBuilder
setCell(int i, int j, String content, CellStyle style)}
public org.apache.poi.ss.usermodel.Sheet getCurrentSheet()
getCurrentSheet
in interface IExcelBuilder
public int getCurrentSheetId()
getCurrentSheetId
in interface IExcelBuilder
public void setCurrentSheetId(int s)
setCurrentSheetId
in interface IExcelBuilder
public int newSheet(int index, String name)
newSheet
in interface IExcelBuilder
public Collection<org.apache.poi.ss.usermodel.Sheet> getAllSheets()
getAllSheets
in interface IExcelBuilder
public void setRowHeight(int row, int height)
setRowHeight
in interface IExcelBuilder
public void setColumnWidth(int column, int width)
setColumnWidth
in interface IExcelBuilder
public void setColumnWidthAuto(int column)
setColumnWidthAuto
in interface IExcelBuilder
public void setFreezePane(int colSplit, int rowSplit)
setFreezePane
in interface IExcelBuilder
public void setFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)
setFreezePane
in interface IExcelBuilder
public void setSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane)
setSplitPane
in interface IExcelBuilder
public void mergeRange(int firstRow, int firstColumn, int lastRow, int lastColumn)
mergeRange
in interface IExcelBuilder
public org.apache.poi.ss.usermodel.CellStyle newCellStyle()
ExcelBuilder.Type
.newCellStyle
in interface IExcelBuilder
public org.apache.poi.ss.usermodel.Comment addComment(org.apache.poi.ss.usermodel.Cell cell, String text, int row, int col, int colWidth, int rowHeight)
addComment
in interface IExcelBuilder
public org.apache.poi.ss.usermodel.Comment buildComment(String text, int row, int col, int colWidth, int rowHeight)
row
- col
- colWidth
- rowHeight
- public org.apache.poi.ss.usermodel.CellStyle newColoredCellStyle(ByteColor color)
newColoredCellStyle
in interface IExcelBuilder
public org.apache.poi.hssf.util.HSSFColor getColor(ByteColor color)
getColor
in interface IExcelBuilder
public org.apache.poi.hssf.util.HSSFColor getColor(byte r, byte g, byte b)
public int loadPicture(String image) throws IOException
loadPicture
in interface IExcelBuilder
IOException
public void setPicture(int pictureIdx, int col1, int row1, boolean resize)
setPicture
in interface IExcelBuilder
public org.apache.poi.ss.usermodel.Font getBoldFont()
getBoldFont
in interface IExcelBuilder
public org.apache.poi.ss.usermodel.Font newFont(int size)
newFont
in interface IExcelBuilder
public org.apache.poi.ss.usermodel.Font newFont()
newFont
in interface IExcelBuilder
public void save(String file) throws IOException
save
in interface IExcelBuilder
IOException
public void save(File file) throws IOException
save
in interface IExcelBuilder
IOException
public org.apache.poi.ss.usermodel.Workbook load(String file) throws org.apache.poi.openxml4j.exceptions.InvalidFormatException, IOException
load
in interface IExcelBuilder
org.apache.poi.openxml4j.exceptions.InvalidFormatException
IOException
public org.apache.poi.ss.usermodel.Workbook load(File file) throws org.apache.poi.openxml4j.exceptions.InvalidFormatException, IOException
load
in interface IExcelBuilder
org.apache.poi.openxml4j.exceptions.InvalidFormatException
IOException
Copyright © 2015 Nuxeo SA. All rights reserved.