public class PdfExporter extends Object implements SExporter, Serializable
Exporter
interface that converts Excel data
model io.keikai.model.Book
into a PDF format written to a
OutputStream
Modifier and Type | Field and Description |
---|---|
protected String |
_bookName |
protected double |
_bottomMargin |
protected int[] |
_colBreaks |
protected double[] |
_colLeft |
protected int[] |
_colLeftPx |
protected SSheet |
_currentSheet |
protected int |
_currentSheetIndex |
protected com.lowagie.text.Rectangle |
_customPaperSize |
protected com.lowagie.text.Font |
_docStandardFont |
protected int |
_endCol |
protected int |
_endRow |
protected TreeSet<CellRegion> |
_extendRegions |
protected int |
_firstCol |
protected boolean |
_firstPage |
protected int |
_firstRow |
protected double |
_footerMargin |
protected boolean |
_hcenter |
protected double |
_headerMargin |
protected double |
_leftMargin |
protected int |
_pageCol1 |
protected int |
_pageCol2 |
protected int |
_pageCount |
protected int |
_pageNumber |
protected int |
_pageRow1 |
protected int |
_pageRow2 |
protected com.lowagie.text.Rectangle |
_paperSize |
protected List<SPicture> |
_pictures |
protected int |
_printCol1 |
protected int |
_printCol2 |
protected boolean |
_printGridlines |
protected boolean |
_printHeadings |
protected int |
_printRow1 |
protected int |
_printRow2 |
protected SPrintSetup |
_printSetup |
protected double[] |
_repeatColLeft |
protected int[] |
_repeatColLeftPx |
protected double[] |
_repeatRowTop |
protected int[] |
_repeatRowTopPx |
protected double |
_rightMargin |
protected int[] |
_rowBreaks |
protected double[] |
_rowTop |
protected int[] |
_rowTopPx |
protected int |
_scale |
protected String |
_sheetName |
protected int |
_titleCol1 |
protected int |
_titleCol2 |
protected int |
_titleRow1 |
protected int |
_titleRow2 |
protected double |
_topMargin |
protected double |
_totalHeaderFooterWidth |
protected double |
_totalPrintHeight |
protected double |
_totalPrintWidth |
protected boolean |
_vcenter |
protected SBook |
_wb |
protected com.lowagie.text.pdf.PdfWriter |
_writer |
protected static float |
ACCOUNT_UNDERLINE_OFFSET |
protected static float |
DOUBLE_LINE_SPACE |
protected static float |
DOUBLE_LINE_WIDTH |
protected static float |
GRIDLINE_WIDTH |
protected static String |
IGNORE_COLUMN_BREAK_PROPERTY_KEY |
protected static String |
IGNORE_ROW_BREAK_PROPERTY_KEY |
protected Map<SChart,BufferedImage> |
imageCacher |
protected static float |
OUTLINE_WIDTH |
protected static float |
PAD_BOTTOM |
protected static float |
PAD_LEFT |
protected static float |
PAD_RIGHT |
protected static float |
PAD_TOP |
protected static float |
UNDERLINE_OFFSET |
protected static float |
UNDERLINE_WIDTH |
protected static String |
ZSS_IGNORE_COLUMN_BREAK_PROPERTY_KEY |
protected static String |
ZSS_IGNORE_ROW_BREAK_PROPERTY_KEY |
Constructor and Description |
---|
PdfExporter() |
Modifier and Type | Method and Description |
---|---|
protected void |
addExtendRegion(CellRegion region) |
protected static int[] |
convertIntegers(List<Integer> integers)
converts List
|
protected com.lowagie.text.pdf.PdfPCell |
createEmptyRowSpanCell(SSheet sheet,
CellRegion outlineRegion,
double rowHeight,
CellRegion renderRegion,
int rowIdx,
int colIdx,
boolean printOutline,
boolean printGridline) |
protected com.lowagie.text.pdf.PdfPCell |
createPdfCell(CellRegion clipRegion,
CellRegion renderRegion,
SCell zssCell,
CellRegion outlineRegion,
SSheet sheet,
boolean printGridLines,
boolean printOutline,
boolean extended)
creates a PdfCell from POI
Cell |
protected com.lowagie.text.Font |
createPdfCellFont(SFont zssFont)
returns pdf font corresponding to ZSS cell font
|
protected com.lowagie.text.Font |
createPdfCellFont(SFont zssFont,
String fontName)
Returns pdf font corresponding to ZSS cell font with a supplimental font face name.
|
protected List<com.lowagie.text.Chunk> |
createPdfChunks(SFont zssFont,
String text,
boolean accountingUnder)
Create and returns pdf chunks per the provided ZSS font, text, and
whether contains a Accounting Underline (because it is handled the
other way; see
CellRenderEvent.drawAccountingUnderline(com.lowagie.text.Rectangle, com.lowagie.text.Rectangle, float, float, float, float, com.lowagie.text.pdf.PdfContentByte) ) |
protected com.lowagie.text.pdf.PdfPTable |
createPdfTable(int bCol,
int eCol,
SSheet sheet) |
protected Object[] |
createPhrase(SCell zssCell)
creates Phrase for corresponding ZSS Cell.
|
protected com.lowagie.text.Image |
cropImage(com.lowagie.text.Image image,
float origWidth,
float origHeight,
com.lowagie.text.pdf.PdfWriter writer,
float x,
float y,
float width,
float height) |
protected void |
drawLine(com.lowagie.text.pdf.PdfContentByte lineCanvas,
float x1,
float y1,
float x2,
float y2) |
void |
export(SBook book,
File file)
Export a book
|
void |
export(SBook workbook,
OutputStream outputStream)
Exports Keikai Spreadsheet
Book into another format written to a
OutputStream . |
void |
export(SheetRegion sheetRegion,
OutputStream outputStream)
Exports selected area of Keikai Spreadsheet active sheet represented by
io.keikai.model.sys.XRange |
void |
export(SSheet worksheet,
OutputStream outputStream)
Exports Keikai Spreadsheet
SSheet into another format written to a |
protected void |
exportSheet(SSheet sheet,
int sheetIndex,
com.lowagie.text.Document doc)
converts POI
SSheet to Pdf page(s) |
protected void |
exportSheetSelection(SSheet sheet,
int sheetIndex,
CellRegion area,
com.lowagie.text.Document doc)
converts POI
SSheet to Pdf page(s) |
protected int |
getAcrossSelectionColumn0(SSheet sheet,
int rowIdx,
int colIdx) |
protected int |
getCountOfColTitles() |
protected SFooter |
getCurrentFooter(SSheet sheet) |
protected SHeader |
getCurrentHeader(SSheet sheet) |
protected SPrintSetup |
getCurrentPrintSetup(SSheet sheet) |
protected int |
getExtendedEndColumn(SSheet sheet,
SCell zssCell,
int colIdx) |
protected int |
getExtendedEndColumn0(SSheet sheet,
SCell zssCell,
int colIdx) |
protected CellRegion |
getExtendRegion(int rowIdx,
int colIdx) |
protected CellRegion |
getMergedRegionIfAny(SSheet sheet,
int rowIdx,
int colIdx)
returns merged region cell range for a given cell
|
protected void |
getPictureData(SSheet sheet)
retrieve all zkpictures for given sheet
|
protected io.keikai.model.impl.pdf.PixelInfo |
getPixelInfo(CellRegion clipRegion) |
protected CellRegion[] |
getPrintAreas(SPrintSetup ps,
SSheet sheet) |
SPrintSetup |
getPrintSetup()
Get this setup to setup the exporting parameters for "print" as a PDF
document
|
protected double |
getRegionHeight(CellRegion region) |
protected double |
getRegionWidth(CellRegion region) |
protected double |
getTitleHeight() |
protected double |
getTitleWidth() |
protected void |
initDocument(SSheet sheet,
com.lowagie.text.Document doc)
Set pdf page common properties such as margins and document standard font
|
protected void |
initDocumentForSheet(SSheet sheet,
com.lowagie.text.Document doc) |
protected void |
initPrintArea(SSheet sheet,
CellRegion region)
sets the column bounds for passed
SSheet |
protected void |
initRowColumnPositions(SSheet sheet) |
protected void |
initSelectedPrintArea(SSheet sheet) |
protected void |
initSheetPrintSetup(SSheet sheet) |
protected boolean |
isColPageBreak(int col) |
protected boolean |
isEvenPage(int no) |
protected boolean |
isPartOfMergedRegion(SSheet sheet,
SCell cell)
checks if POI
Cell is part of any merged regions on the passed
SSheet |
protected boolean |
isRowPageBreak(int row) |
protected boolean |
isUseColTitles() |
protected boolean |
isUseRowTitles() |
protected void |
layoutCharts(SSheet sheet,
int bRow,
int eRow,
int bCol,
int eCol,
com.lowagie.text.pdf.PdfWriter writer) |
protected void |
layoverPictureIfAny(SSheet sheet,
int bRow,
int eRow,
int bCol,
int eCol,
com.lowagie.text.pdf.PdfWriter writer)
lays images over PdfTable
|
protected int |
normalizeScale(int scale) |
protected io.keikai.model.impl.pdf.RenderInfo |
prepareClipInfo(CellRegion clipRegion) |
protected void |
prepareColBreaks(SSheet sheet,
boolean ignoreManualBreaks) |
protected int |
prepareFitPageScale(SSheet sheet,
int fitWidth,
int fitHeight) |
protected com.lowagie.text.pdf.FontSelector |
prepareFontSelector(SFont zssFont)
Prepare a FontSelector which can apply eastern supplemental fonts to
text.
|
protected double[] |
preparePageXYInfo(SSheet sheet,
int bRow,
int eRow,
int bCol,
int eCol) |
protected io.keikai.model.impl.pdf.RenderInfo |
prepareRenderInfo(CellRegion clipRegion,
CellRegion renderRegion,
boolean extended,
boolean number) |
protected void |
prepareRowBreaks(SSheet sheet,
boolean ignoreManualBreaks)
Sets column/row breaks if not defined already
|
protected int |
prepareScaleX(SSheet sheet,
int fitWidth) |
protected int |
prepareScaleY(SSheet sheet,
int fitHeight) |
protected int |
printCell(com.lowagie.text.pdf.PdfPTable pdfTable,
int rowIdx,
int colIdx,
SSheet sheet,
double rowHeight,
int bRow,
int eRow,
int bCol,
int eCol,
CellRegion outlineRegion) |
protected void |
printColHeadingCell(com.lowagie.text.pdf.PdfPTable pdfTable,
int colIdx,
float rowHeight) |
protected void |
printColHeadings(com.lowagie.text.pdf.PdfPTable pdfTable,
int bCol,
int eCol,
float rowHeight) |
protected void |
printHeadingCell(com.lowagie.text.pdf.PdfPTable pdfTable,
com.lowagie.text.Phrase p,
float rowHeight) |
protected void |
printImage(com.lowagie.text.pdf.PdfContentByte canvas,
byte[] rawData,
ViewAnchor anchor1,
ViewAnchor anchor2,
CellRegion clipRegion,
CellRegion renderRegion,
double pageColumnX,
double pageRowY,
double clipOffsetX,
double clipOffsetY,
boolean outline) |
protected void |
printPage(int bRow,
int eRow,
int bCol,
int eCol,
SSheet sheet,
com.lowagie.text.Document doc) |
protected void |
printRow(com.lowagie.text.pdf.PdfPTable pdfTable,
int rowIdx,
int bRow,
int eRow,
int bCol,
int eCol,
SSheet sheet,
float rowHeight,
CellRegion outlineRegion) |
protected void |
printRowHeadingCell(com.lowagie.text.pdf.PdfPTable pdfTable,
int rowIdx,
float rowHeight) |
protected void |
printScalePages(float scale,
com.lowagie.text.Document doc,
byte[] pdfIn) |
protected void |
printScaleSheet(SSheet sheet,
com.lowagie.text.Document doc,
SPrintSetup ps) |
protected void |
printSheet(SSheet sheet,
com.lowagie.text.Document doc) |
protected com.lowagie.text.Chunk |
processPdfChunk(SFont zssFont,
com.lowagie.text.Chunk chunk,
boolean accountingUnder) |
protected int |
searchNonBlankEndColumn(SSheet sheet,
int rowIdx,
int lastColIdx)
Returns the last cell that contains value
|
protected void |
setCustomPaperSize(float width,
float height) |
protected void |
setupColumnBreaks(SSheet sheet)
sets auto column breaks based on column width and available page width
|
protected com.lowagie.text.Document |
setupExporter(SSheet sheet,
OutputStream outputStream,
com.lowagie.text.Document document) |
protected void |
setupRowBreaks(SSheet sheet)
sets auto row breaks based on row heights and available total page height
|
protected CellRegion |
splitRegionsInBoundaries(CellRegion region,
int bRow,
int eRow,
int bCol,
int eCol) |
protected void |
throwIOException(com.lowagie.text.ExceptionConverter ex) |
protected static final float PAD_TOP
protected static final float PAD_BOTTOM
protected static final float PAD_LEFT
protected static final float PAD_RIGHT
protected static final float OUTLINE_WIDTH
protected static final float GRIDLINE_WIDTH
protected static final float DOUBLE_LINE_SPACE
protected static final float DOUBLE_LINE_WIDTH
protected static final float UNDERLINE_WIDTH
protected static final float UNDERLINE_OFFSET
protected static final float ACCOUNT_UNDERLINE_OFFSET
protected SBook _wb
protected com.lowagie.text.pdf.PdfWriter _writer
protected int[] _colBreaks
protected int[] _rowBreaks
protected int _firstCol
protected int _endCol
protected int _firstRow
protected int _endRow
protected int _printCol1
protected int _printCol2
protected int _printRow1
protected int _printRow2
protected int _pageCount
protected int _pageNumber
protected String _sheetName
protected String _bookName
protected com.lowagie.text.Font _docStandardFont
protected SPrintSetup _printSetup
protected com.lowagie.text.Rectangle _paperSize
protected double _totalHeaderFooterWidth
protected double _leftMargin
protected double _rightMargin
protected double _topMargin
protected double _bottomMargin
protected double _headerMargin
protected double _footerMargin
protected double _totalPrintWidth
protected double _totalPrintHeight
protected double[] _repeatColLeft
protected double[] _repeatRowTop
protected double[] _colLeft
protected double[] _rowTop
protected int[] _repeatColLeftPx
protected int[] _repeatRowTopPx
protected int[] _colLeftPx
protected int[] _rowTopPx
protected int _currentSheetIndex
protected boolean _firstPage
protected SSheet _currentSheet
protected int _titleCol1
protected int _titleCol2
protected int _titleRow1
protected int _titleRow2
protected boolean _printGridlines
protected boolean _printHeadings
protected boolean _hcenter
protected boolean _vcenter
protected TreeSet<CellRegion> _extendRegions
protected com.lowagie.text.Rectangle _customPaperSize
protected int _scale
protected int _pageRow1
protected int _pageRow2
protected int _pageCol1
protected int _pageCol2
protected Map<SChart,BufferedImage> imageCacher
protected static final String IGNORE_COLUMN_BREAK_PROPERTY_KEY
protected static final String IGNORE_ROW_BREAK_PROPERTY_KEY
protected static final String ZSS_IGNORE_COLUMN_BREAK_PROPERTY_KEY
protected static final String ZSS_IGNORE_ROW_BREAK_PROPERTY_KEY
public void export(SBook book, File file) throws IOException
SExporter
export
in interface SExporter
book
- the book to exportIOException
public void export(SBook workbook, OutputStream outputStream) throws IOException
Book
into another format written to a
OutputStream
. Note that it exports entire workbook.export
in interface SExporter
workbook
- outputStream
- IOException
public void export(SSheet worksheet, OutputStream outputStream) throws IOException
SSheet
into another format written to aexport
in interface SExporter
worksheet
- sheet instance that contains selected areaoutputStream
- outoutStream to which exported contents to be writtenIOException
public void export(SheetRegion sheetRegion, OutputStream outputStream) throws IOException
io.keikai.model.sys.XRange
export
in interface SExporter
worksheet
- sheet instance that contains selected areaarea
- area representing selected area to be exportedoutputStream
- outoutStream to which exported contents to be writtenIOException
protected void throwIOException(com.lowagie.text.ExceptionConverter ex) throws IOException
IOException
protected com.lowagie.text.Document setupExporter(SSheet sheet, OutputStream outputStream, com.lowagie.text.Document document) throws com.lowagie.text.DocumentException
outputStream
- com.lowagie.text.DocumentException
protected void printScalePages(float scale, com.lowagie.text.Document doc, byte[] pdfIn) throws IOException
IOException
protected int normalizeScale(int scale)
protected void printScaleSheet(SSheet sheet, com.lowagie.text.Document doc, SPrintSetup ps) throws IOException
IOException
protected int prepareFitPageScale(SSheet sheet, int fitWidth, int fitHeight)
protected int prepareScaleY(SSheet sheet, int fitHeight)
protected int prepareScaleX(SSheet sheet, int fitWidth)
protected void exportSheetSelection(SSheet sheet, int sheetIndex, CellRegion area, com.lowagie.text.Document doc) throws com.lowagie.text.DocumentException, IOException
SSheet
to Pdf page(s)sheet
- com.lowagie.text.DocumentException
IOException
protected void initRowColumnPositions(SSheet sheet)
protected void exportSheet(SSheet sheet, int sheetIndex, com.lowagie.text.Document doc) throws com.lowagie.text.DocumentException, IOException
SSheet
to Pdf page(s)sheet
- com.lowagie.text.DocumentException
IOException
protected CellRegion[] getPrintAreas(SPrintSetup ps, SSheet sheet)
protected void getPictureData(SSheet sheet)
sheet
- protected void prepareRowBreaks(SSheet sheet, boolean ignoreManualBreaks)
sheet
- protected void prepareColBreaks(SSheet sheet, boolean ignoreManualBreaks)
protected void setupRowBreaks(SSheet sheet)
sheet
- protected void setupColumnBreaks(SSheet sheet)
sheet
- protected boolean isColPageBreak(int col)
protected boolean isRowPageBreak(int row)
protected static int[] convertIntegers(List<Integer> integers)
integers
- protected void setCustomPaperSize(float width, float height)
protected void initDocument(SSheet sheet, com.lowagie.text.Document doc)
SSheet
- sheetprotected void initDocumentForSheet(SSheet sheet, com.lowagie.text.Document doc)
protected void printSheet(SSheet sheet, com.lowagie.text.Document doc) throws com.lowagie.text.DocumentException, IOException
com.lowagie.text.DocumentException
IOException
protected void printPage(int bRow, int eRow, int bCol, int eCol, SSheet sheet, com.lowagie.text.Document doc) throws com.lowagie.text.DocumentException
com.lowagie.text.DocumentException
protected void printRow(com.lowagie.text.pdf.PdfPTable pdfTable, int rowIdx, int bRow, int eRow, int bCol, int eCol, SSheet sheet, float rowHeight, CellRegion outlineRegion)
protected int printCell(com.lowagie.text.pdf.PdfPTable pdfTable, int rowIdx, int colIdx, SSheet sheet, double rowHeight, int bRow, int eRow, int bCol, int eCol, CellRegion outlineRegion)
protected com.lowagie.text.pdf.PdfPCell createEmptyRowSpanCell(SSheet sheet, CellRegion outlineRegion, double rowHeight, CellRegion renderRegion, int rowIdx, int colIdx, boolean printOutline, boolean printGridline)
protected CellRegion splitRegionsInBoundaries(CellRegion region, int bRow, int eRow, int bCol, int eCol)
protected CellRegion getExtendRegion(int rowIdx, int colIdx)
protected void addExtendRegion(CellRegion region)
protected com.lowagie.text.pdf.PdfPTable createPdfTable(int bCol, int eCol, SSheet sheet) throws com.lowagie.text.DocumentException
com.lowagie.text.DocumentException
protected void printColHeadings(com.lowagie.text.pdf.PdfPTable pdfTable, int bCol, int eCol, float rowHeight)
protected void printColHeadingCell(com.lowagie.text.pdf.PdfPTable pdfTable, int colIdx, float rowHeight)
protected void printRowHeadingCell(com.lowagie.text.pdf.PdfPTable pdfTable, int rowIdx, float rowHeight)
protected void printHeadingCell(com.lowagie.text.pdf.PdfPTable pdfTable, com.lowagie.text.Phrase p, float rowHeight)
protected double[] preparePageXYInfo(SSheet sheet, int bRow, int eRow, int bCol, int eCol)
protected void printImage(com.lowagie.text.pdf.PdfContentByte canvas, byte[] rawData, ViewAnchor anchor1, ViewAnchor anchor2, CellRegion clipRegion, CellRegion renderRegion, double pageColumnX, double pageRowY, double clipOffsetX, double clipOffsetY, boolean outline) throws IOException
IOException
protected void drawLine(com.lowagie.text.pdf.PdfContentByte lineCanvas, float x1, float y1, float x2, float y2)
protected void layoverPictureIfAny(SSheet sheet, int bRow, int eRow, int bCol, int eCol, com.lowagie.text.pdf.PdfWriter writer) throws IOException
sheet
- bRow
- eRow
- bCol
- eCol
- IOException
protected com.lowagie.text.Image cropImage(com.lowagie.text.Image image, float origWidth, float origHeight, com.lowagie.text.pdf.PdfWriter writer, float x, float y, float width, float height) throws com.lowagie.text.DocumentException
com.lowagie.text.DocumentException
protected void layoutCharts(SSheet sheet, int bRow, int eRow, int bCol, int eCol, com.lowagie.text.pdf.PdfWriter writer) throws IOException
IOException
protected CellRegion getMergedRegionIfAny(SSheet sheet, int rowIdx, int colIdx)
sheet
- cell
- protected boolean isPartOfMergedRegion(SSheet sheet, SCell cell)
Cell
is part of any merged regions on the passed
SSheet
SSheet
- sheetCell
- cellprotected com.lowagie.text.pdf.PdfPCell createPdfCell(CellRegion clipRegion, CellRegion renderRegion, SCell zssCell, CellRegion outlineRegion, SSheet sheet, boolean printGridLines, boolean printOutline, boolean extended)
Cell
zssCell
- protected io.keikai.model.impl.pdf.RenderInfo prepareClipInfo(CellRegion clipRegion)
protected io.keikai.model.impl.pdf.RenderInfo prepareRenderInfo(CellRegion clipRegion, CellRegion renderRegion, boolean extended, boolean number)
protected double getRegionWidth(CellRegion region)
protected double getRegionHeight(CellRegion region)
protected Object[] createPhrase(SCell zssCell)
zssCell
- protected com.lowagie.text.Font createPdfCellFont(SFont zssFont)
zssFont
- protected com.lowagie.text.Font createPdfCellFont(SFont zssFont, String fontName)
zssFont
- fontName
- protected com.lowagie.text.pdf.FontSelector prepareFontSelector(SFont zssFont)
protected List<com.lowagie.text.Chunk> createPdfChunks(SFont zssFont, String text, boolean accountingUnder)
CellRenderEvent.drawAccountingUnderline(com.lowagie.text.Rectangle, com.lowagie.text.Rectangle, float, float, float, float, com.lowagie.text.pdf.PdfContentByte)
)protected com.lowagie.text.Chunk processPdfChunk(SFont zssFont, com.lowagie.text.Chunk chunk, boolean accountingUnder)
protected int searchNonBlankEndColumn(SSheet sheet, int rowIdx, int lastColIdx)
protected void initSelectedPrintArea(SSheet sheet)
protected void initPrintArea(SSheet sheet, CellRegion region)
SSheet
sheet
- protected int getAcrossSelectionColumn0(SSheet sheet, int rowIdx, int colIdx)
public SPrintSetup getPrintSetup()
protected void initSheetPrintSetup(SSheet sheet)
protected SPrintSetup getCurrentPrintSetup(SSheet sheet)
protected boolean isEvenPage(int no)
protected boolean isUseColTitles()
protected boolean isUseRowTitles()
protected int getCountOfColTitles()
protected double getTitleWidth()
protected double getTitleHeight()
protected io.keikai.model.impl.pdf.PixelInfo getPixelInfo(CellRegion clipRegion)
Copyright © 2020. All rights reserved.