public abstract class ReportGenerator extends Object
setBold(boolean) with true value, all texts added thereafter to the report will be rendered bold,
until another call to setBold(boolean) is made with false value.beginTable(int, int...),
add any valid elements to it (with each specific command call) and then call endTable.ResultSet).release() is highly recommended.EmptyStackException and
IllegalStateException.ReportGenerator class isn't thread-safe, but obviously each instance of a ReportGenerator should be (and in fact
they are) independent, allowing the existence of multiple instances without interference between them.| Modifier and Type | Field and Description |
|---|---|
protected static float |
PIXELS_TO_UNITS_FACTOR
Conversion factor from pixels to PDF units.
|
protected float |
UNITS_TO_PIXELS
Conversion factor from PDF units to pixels
|
| Constructor and Description |
|---|
ReportGenerator() |
| Modifier and Type | Method and Description |
|---|---|
ReportColor |
addColor(int red,
int green,
int blue,
String name)
Declare a color in RGB mode.
|
void |
addCurrentPageNumber()
Add the current page number to the report.
|
void |
addImage(byte[] img,
String imgName,
int width)
Add an image defined by a byte array of its format (usually it's safe to consider that all ReportGenerator's
who support images will support PNG and JPG images formats here).
|
void |
addImage(byte[] img,
String imgName,
int width,
int height)
Add an image defined by a byte array of its format, defining its width and height.
|
void |
addLineBreak()
Add a line break to the document.
|
void |
addLineSpaces(int n)
Add
n blank lines to the report. |
void |
addLinkedImage(String imgLink,
int width)
Add an image to the document by its link.
|
void |
addLinkedImage(String imgLink,
int width,
int height)
Add an image to the document by its link.
|
void |
addSeparatorLine()
Add an horizontal line (-----) separator to the report.
|
void |
addTableCell(String element)
Adds a textual table cell element to the page.
|
void |
addTableCell(String element,
int colspan,
int rowspan)
Same of
addTableCell(String), but defining its spans. |
void |
addTableHeaderCell(String columnName)
Add a table header title text for a single table column.
|
void |
addTableHeaderCell(String columnName,
int colspan)
Add a table header title text.
|
void |
addTableHeaderRow(List<String> header)
Create a table header row with a predefined list of table column's titles.
|
void |
addTableRow(List<String> cells)
Generate a table line
Note: only use this function if a priori (ie: at the moment of ResultSet iteration) it isn't possible to add the columns. |
void |
addText(String text)
Add (or better, append) a contiguous text to the report.
|
void |
addTextLine(String line)
Add text to the report with a line break at end.
|
void |
addTextWithNullSupport(String text)
Add (or better, append) a contiguous text to the report, replacing
null and empty values with '-'. |
void |
addTotalPagesCount()
Add the number of total report pages to the report.
|
void |
beginDocument()
Start the document.
|
void |
beginDocumentBody()
Begin the report document's body, where usually are all data to report.
|
void |
beginDocumentHead()
Begin the document's head, where should lies all specific implementation declarations.
|
void |
beginGroup(ReportGroupType type)
Begin a group of report elements.
|
void |
beginGroup(ReportGroupType type,
String name)
Begin a named group of report elements.
|
void |
beginPageFooterCenter()
Init the center page footer definition.
|
void |
beginPageFooterLeft()
Init the left page footer definition.
|
void |
beginPageFooterRight()
Init the right page footer definition.
|
void |
beginPageHeaderCenter()
Begin the center page header definition.
|
void |
beginPageHeaderLeft()
Begin the right page header definition.
|
void |
beginPageHeaderRight()
Begin the right page header definition.
|
void |
beginTable(int totalColumns,
int... eachColumnWidth)
Begin a table, defining or not the width of all its columns.
|
void |
beginTableCell()
Begin the creation of a table element (cell), of a single column in a single row.
|
void |
beginTableCell(int colspan,
int rowspan)
Begin the creation of a table element (cell).
|
void |
beginTableHeaderRow()
Begin the definition of a table header row.
|
void |
beginTableRow()
Init a table row.
|
void |
beginTableWithFixedDefinedWidth(int totalColumns,
int fixedWidth)
Begin a table definition, setting all column's width to the same fixed value.
|
protected void |
checkDocumentNotFinished()
Check if document is inited and not yet finished.
|
protected void |
checkNotOpenedFooterOrHeader()
Check if no footer or header block is currently opened.
|
protected void |
checkStackState(boolean pop,
net.sf.nervalreports.core.ReportGenerator.ReportBlockToken... expected)
Verify the top of currently opened commands, expecting at last one type.
|
protected abstract void |
doAddColor(ReportColor color)
Add a color to the document.
|
protected abstract void |
doAddCurrentPageNumber()
The format specific implementation of
addCurrentPageNumber(). |
protected abstract void |
doAddImage(byte[] img,
String imgName,
int width)
The format specific implementation of
addImage(byte[], java.lang.String, int). |
protected abstract void |
doAddImage(byte[] img,
String imgName,
int width,
int height)
The format specific implementation of
addImage(byte[], java.lang.String, int). |
protected abstract void |
doAddLinkedImage(String imgLink,
int width)
The format specific implementation of
addLinkedImage(java.lang.String, int). |
protected abstract void |
doAddLinkedImage(String imgLink,
int width,
int height)
The format specific implementation of
addLinkedImage(java.lang.String, int). |
protected abstract void |
doAddSeparatorLine()
The format specific implementation of
addSeparatorLine(). |
protected abstract void |
doAddTableHeaderCell(String columnName,
int colspan)
The format specific implementation of
addTableHeaderCell(java.lang.String). |
protected abstract void |
doAddText(String text)
The format specific implementation of
addText(java.lang.String). |
protected abstract void |
doAddTotalPagesCount()
The format specific implementation of
addTotalPagesCount(). |
protected abstract void |
doBeginDocument()
The format specific implementation of
beginDocument(). |
protected abstract void |
doBeginDocumentBody()
The format specific implementation of
beginDocumentBody(). |
protected abstract void |
doBeginDocumentHead()
The format specific implementation of
beginDocumentHead(). |
protected abstract void |
doBeginGroup(ReportGroupType type,
String name)
The format specific implementation of
beginGroup(net.sf.nervalreports.core.ReportGroupType). |
protected abstract void |
doBeginPageFooterCenter()
The format specific implementation of
beginPageFooterCenter(). |
protected abstract void |
doBeginPageFooterLeft()
The format specific implementation of
beginPageFooterLeft(). |
protected abstract void |
doBeginPageFooterRight()
The format specific implementation of
beginPageFooterRight(). |
protected abstract void |
doBeginPageHeaderCenter()
The format specific implementation of
beginPageHeaderCenter(). |
protected abstract void |
doBeginPageHeaderLeft()
The format specific implementation of
beginPageHeaderLeft(). |
protected abstract void |
doBeginPageHeaderRight()
The format specific implementation of
beginPageHeaderRight(). |
protected abstract void |
doBeginTable(int totalColumns,
int[] eachColumnWidth)
The format specific implementation of
beginTable(int, int...). |
protected abstract void |
doBeginTableCell(int colspan,
int rowspan)
The format specific implementation of
beginTableCell(int, int). |
protected abstract void |
doBeginTableHeaderRow()
The format specific implementation of
beginTableHeaderRow(). |
protected abstract void |
doBeginTableRow()
The format specific implementation of
beginTableRow(). |
protected abstract void |
doCreateLineSpaces(int n)
The format specific implementation of
addLineSpaces(int). |
protected abstract void |
doDefineMargins(int left,
int top,
int right,
int bottom)
The format specific implementation of
setMargins(int, int, int, int). |
protected abstract void |
doEndDocument()
The format specific implementation of
endDocument(). |
protected abstract void |
doEndDocumentBody()
The format specific implementation of
endDocumentBody(). |
protected abstract void |
doEndDocumentHead()
The format specific implementation of
endDocumentHead(). |
protected abstract void |
doEndGroup(ReportGroupType type)
The format specific implementation of
endGroup(). |
protected abstract void |
doEndPageFooterCenter()
The format specific implementation of
endPageFooterCenter(). |
protected abstract void |
doEndPageFooterLeft()
The format specific implementation of
endPageFooterLeft(). |
protected abstract void |
doEndPageFooterRight()
The format specific implementation of
endPageFooterRight(). |
protected abstract void |
doEndPageHeaderCenter()
The format specific implementation of
endPageHeaderCenter(). |
protected abstract void |
doEndPageHeaderLeft()
The format specific implementation of
endPageHeaderLeft(). |
protected abstract void |
doEndPageHeaderRight()
The format specific implementation of
endPageHeaderRight(). |
protected abstract void |
doEndTable()
The format specific implementation of
endTable(). |
protected abstract void |
doEndTableCell()
The format specific implementation of
endTableCell(). |
protected abstract void |
doEndTableHeaderRow()
The format specific implementation of
endTableHeaderRow(). |
protected abstract void |
doEndTableRow()
The format specific implementation of
endTableRow(). |
protected abstract void |
doHintFont(boolean serifedFont)
Implementation of the hint to use a serifed or non-serifed font.
|
protected abstract void |
doHintLanguage(String language)
The format specific implementation of
hintLanguage(String). |
protected abstract void |
doLineBreak()
The format specific implementation of
addLineBreak(). |
void |
endDocument()
End the document.
|
void |
endDocumentBody()
End the currently opened report body.
|
void |
endDocumentHead()
End the head of the document.
|
void |
endGroup()
End the current opened group of report elements.
|
void |
endPageFooterCenter()
End the center page footer definition.
|
void |
endPageFooterLeft()
End the left page footer definition.
|
void |
endPageFooterRight()
End the right page footer definition.
|
void |
endPageHeaderCenter()
End the center page header definition.
|
void |
endPageHeaderLeft()
End the center page header definition.
|
void |
endPageHeaderRight()
End the right page header definition.
|
void |
endTable()
End the current table.
|
void |
endTableCell()
Ends the definition of a table cell element.
|
void |
endTableHeaderRow()
End the declaration of current table header row.
|
void |
endTableRow()
Ends the definition of a table row line.
|
ReportColor |
getBorderColor() |
Float |
getBorderWidth() |
ReportColor |
getEvenRowColor() |
abstract String |
getFileExtension() |
ReportFontSize |
getFontSize() |
protected int |
getFontSizeInPoints() |
ReportColor |
getHeaderBackgroundColor() |
int[] |
getMargins() |
ReportColor |
getOddRowColor() |
ReportPaperFormat |
getPaperFormat() |
ReportCharset |
getReportCharset() |
ReportColor |
getRowColor() |
protected StringBuilder |
getStringBuilder() |
ReportTextAlignment |
getTextAlignment()
return
textAlignment. |
ReportColor |
getTextColor() |
void |
hintLanguage(String language)
Hint the language to use.
|
void |
hintNonSerifFont()
Hint to use a non-serifed font.
|
void |
hintSerifFont()
Hint to use a serifed font.
|
boolean |
isBold() |
abstract boolean |
isHeaderAndFooterDeclarationAtDocumentHead() |
protected boolean |
isInsideHeaderOrFooter() |
boolean |
isItalic() |
void |
release()
Clear all references of the report generation (including temporary files created) when they are no
more necessary (for example, on reports generated for web applications, after it is sent to the client).
|
void |
saveToFile(String filename)
Save the contents of the generated report to a file.
|
void |
setBold(boolean bold)
Define
bold. |
void |
setEvenRowColor(ReportColor evenRowColor)
Set
evenRowColor. |
void |
setFontSize(ReportFontSize fontSize)
Set
fontSize. |
void |
setHeaderBackgroundColor(ReportColor headerBackgroundColor)
|
void |
setItalic(boolean italic)
Define
italic. |
void |
setMargins(int left,
int top,
int right,
int bottom)
Define the document's page margins.
|
void |
setOddRowColor(ReportColor oddRowColor)
Set
oddRowColor. |
void |
setPaper(ReportPaperFormat paperFormat)
Set the paper format to use for the whole document (default is
A4). |
void |
setReportCharset(ReportCharset charset)
Define the character set to use.
|
void |
setRowColor(ReportColor rowColor)
Set
rowColor. |
void |
setTableBorderStyle(Float borderWidth,
ReportColor borderColor)
Set table border style that will take effect for next
beginTable(int, int...) call. |
void |
setTextAlignment(ReportTextAlignment textAlignment)
Set
textAlignment. |
void |
setTextColor(ReportColor color)
Define
textColor. |
abstract boolean |
supportImages() |
abstract boolean |
supportImagesOfJarFilesOrURLs() |
byte[] |
toByteArray()
Get the byte array representation of the generated report.
|
String |
toString() |
protected static final float PIXELS_TO_UNITS_FACTOR
protected final float UNITS_TO_PIXELS
public abstract String getFileExtension()
String to be used as extension to the files generated by the generator.public abstract boolean supportImages()
public abstract boolean supportImagesOfJarFilesOrURLs()
public abstract boolean isHeaderAndFooterDeclarationAtDocumentHead()
true) or body (false).protected abstract void doBeginDocument()
throws Exception
beginDocument().Exception - in case of failure.protected abstract void doEndDocument()
throws Exception
endDocument().Exception - in case of failure.protected abstract void doBeginDocumentHead()
throws Exception
beginDocumentHead().Exception - in case of failure.protected abstract void doAddColor(ReportColor color) throws Exception
color - color to add.Exception - in case of failure.protected abstract void doHintFont(boolean serifedFont)
throws Exception
serifedFont - true for serifed fonts, false for non-serifed.Exception - in case of failure.protected abstract void doHintLanguage(String language) throws Exception
hintLanguage(String).Exception - in case of failure.protected abstract void doDefineMargins(int left,
int top,
int right,
int bottom)
throws Exception
setMargins(int, int, int, int).Exception - in case of failure.protected abstract void doEndDocumentHead()
throws Exception
endDocumentHead().Exception - in case of failure.protected abstract void doBeginDocumentBody()
throws Exception
beginDocumentBody().Exception - in case of failure.protected abstract void doEndDocumentBody()
throws Exception
endDocumentBody().Exception - in case of failure.protected abstract void doBeginTable(int totalColumns,
int[] eachColumnWidth)
throws Exception
beginTable(int, int...).Exception - in case of failure.protected abstract void doEndTable()
throws Exception
endTable().Exception - in case of failure.protected abstract void doBeginTableHeaderRow()
throws Exception
beginTableHeaderRow().Exception - in case of failure.protected abstract void doAddTableHeaderCell(String columnName, int colspan) throws Exception
addTableHeaderCell(java.lang.String).Exception - in case of failure.protected abstract void doEndTableHeaderRow()
throws Exception
endTableHeaderRow().Exception - in case of failure.protected abstract void doBeginTableRow()
throws Exception
beginTableRow().Exception - in case of failure.protected abstract void doBeginTableCell(int colspan,
int rowspan)
throws Exception
beginTableCell(int, int).
beginTableCell().Exception - in case of failure.protected abstract void doEndTableCell()
throws Exception
endTableCell().Exception - in case of failure.protected abstract void doEndTableRow()
throws Exception
endTableRow().Exception - in case of failure.protected abstract void doBeginGroup(ReportGroupType type, String name) throws Exception
beginGroup(net.sf.nervalreports.core.ReportGroupType).Exception - in case of failure.protected abstract void doEndGroup(ReportGroupType type) throws Exception
endGroup().Exception - in case of failure.protected abstract void doAddImage(byte[] img,
String imgName,
int width)
throws Exception
addImage(byte[], java.lang.String, int).Exception - in case of failure.protected abstract void doAddLinkedImage(String imgLink, int width) throws Exception
addLinkedImage(java.lang.String, int).Exception - in case of failure.protected abstract void doAddImage(byte[] img,
String imgName,
int width,
int height)
throws Exception
addImage(byte[], java.lang.String, int).Exception - in case of failure.protected abstract void doAddLinkedImage(String imgLink, int width, int height) throws Exception
addLinkedImage(java.lang.String, int).Exception - in case of failure.protected abstract void doCreateLineSpaces(int n)
throws Exception
addLineSpaces(int).Exception - in case of failure.protected abstract void doLineBreak()
throws Exception
addLineBreak().Exception - in case of failure.protected abstract void doAddText(String text) throws Exception
addText(java.lang.String).Exception - in case of failure.protected abstract void doAddSeparatorLine()
throws Exception
addSeparatorLine().Exception - in case of failure.protected abstract void doAddCurrentPageNumber()
throws Exception
addCurrentPageNumber().Exception - in case of failure.protected abstract void doAddTotalPagesCount()
throws Exception
addTotalPagesCount().Exception - in case of failure.protected abstract void doBeginPageHeaderLeft()
throws Exception
beginPageHeaderLeft().Exception - in case of failure.protected abstract void doEndPageHeaderLeft()
throws Exception
endPageHeaderLeft().Exception - in case of failure.protected abstract void doBeginPageHeaderCenter()
throws Exception
beginPageHeaderCenter().Exception - in case of failure.protected abstract void doEndPageHeaderCenter()
throws Exception
endPageHeaderCenter().Exception - in case of failure.protected abstract void doBeginPageHeaderRight()
throws Exception
beginPageHeaderRight().Exception - in case of failure.protected abstract void doEndPageHeaderRight()
throws Exception
endPageHeaderRight().Exception - in case of failure.protected abstract void doBeginPageFooterLeft()
throws Exception
beginPageFooterLeft().Exception - in case of failure.protected abstract void doEndPageFooterLeft()
throws Exception
endPageFooterLeft().Exception - in case of failure.protected abstract void doBeginPageFooterCenter()
throws Exception
beginPageFooterCenter().Exception - in case of failure.protected abstract void doEndPageFooterCenter()
throws Exception
endPageFooterCenter().Exception - in case of failure.protected abstract void doBeginPageFooterRight()
throws Exception
beginPageFooterRight().Exception - in case of failure.protected abstract void doEndPageFooterRight()
throws Exception
endPageFooterRight().Exception - in case of failure.public void saveToFile(String filename) throws ReportGenerationException
filename - path name of the file to save.ReportGenerationException - on file errors.public byte[] toByteArray()
throws ReportGenerationException
ReportGenerationException - on conversion errors.public void release()
public boolean isBold()
bold.public boolean isItalic()
italic.public void setItalic(boolean italic)
italic.italic - new value to italic.public ReportFontSize getFontSize()
fontSize.protected int getFontSizeInPoints()
getFontSize() in points unit.public void setFontSize(ReportFontSize fontSize)
fontSize.fontSize - font size to use.public ReportTextAlignment getTextAlignment()
textAlignment.public void setTextAlignment(ReportTextAlignment textAlignment)
textAlignment. It is usually applied for the next begin* block.textAlignment - text alignment to use.public ReportColor getOddRowColor()
oddRowColor.public void setOddRowColor(ReportColor oddRowColor)
oddRowColor.oddRowColor - new value to oddRowColor.public ReportColor getEvenRowColor()
evenRowColor.public void setEvenRowColor(ReportColor evenRowColor)
evenRowColor.evenRowColor - new value to evenRowColor.public ReportColor getRowColor()
rowColor. Could be null.public void setRowColor(ReportColor rowColor)
rowColor.rowColor - color to use for all rows. If null will use evenRowColor and oddRowColor instead.public ReportColor getHeaderBackgroundColor()
headerBackgroundColor.public void setHeaderBackgroundColor(ReportColor headerBackgroundColor)
headerBackgroundColor - new value to headerBackgroundColor.public ReportColor getBorderColor()
borderColor.public Float getBorderWidth()
borderWidth.public ReportColor getTextColor()
textColor.public void setTextColor(ReportColor color)
textColor.color - new value to textColor.protected StringBuilder getStringBuilder()
getStringBuilder().public void beginDocument()
throws ReportGenerationException
beginDocument() again, one must call
clear()).ReportGenerationException - in case of failure.public void endDocument()
throws ReportGenerationException
ReportGenerationException - in case of failure.public void beginDocumentHead()
throws ReportGenerationException
ReportGenerationException - in case of failure.public ReportColor addColor(int red, int green, int blue, String name) throws ReportGenerationException
red - red component of the color [0, 255].green - green component of the color [0, 255].blue - blue component of the color [0, 255].name - color name (must be unique per report and without spaces).ReportColor declared and created.ReportGenerationException - in case of failure.public void setPaper(ReportPaperFormat paperFormat)
A4).paperFormat - to use.public ReportPaperFormat getPaperFormat()
paperFormat.public void setMargins(int left,
int top,
int right,
int bottom)
throws ReportGenerationException
beginDocument() and before beginDocumentHead() / beginDocumentBody().left - left margin in PDF units.top - top margin in PDF units.right - right margin in PDF units.bottom - bottom margin in PDF units.ReportGenerationExceptionpublic int[] getMargins()
margins.public void hintLanguage(String language) throws ReportGenerationException
language - String with the language as defined by LaTeX babel package {see: http://www.ctan.org/pkg/babel}.ReportGenerationException - in case of failure.public void setReportCharset(ReportCharset charset) throws ReportGenerationException
charset - to define.ReportGenerationException - in case of failure.public ReportCharset getReportCharset()
null should be at VM's default.public void hintSerifFont()
throws ReportGenerationException
ReportGenerationException - in case of failure.public void hintNonSerifFont()
throws ReportGenerationException
ReportGenerationException - in case of failure.public void endDocumentHead()
throws ReportGenerationException
ReportGenerationException - in case of failure.public void beginDocumentBody()
throws ReportGenerationException
ReportGenerationException - in case of failure.public void endDocumentBody()
throws ReportGenerationException
ReportGenerationException - in case of failure.public void setTableBorderStyle(Float borderWidth, ReportColor borderColor)
beginTable(int, int...) call.borderWidth - width to use for table border (null for no border).borderColor - color to use for table border (if its width is not null).public void beginTable(int totalColumns,
int... eachColumnWidth)
throws ReportGenerationException
totalColumns - total number of columns the table has.eachColumnWidth - width, in PDF units, for each table column. If defined, the total number of eachColumnWidth
must be equal to the number of columns.ReportGenerationException - in case of failure.public void beginTableWithFixedDefinedWidth(int totalColumns,
int fixedWidth)
throws ReportGenerationException
totalColumns - total number of columns the table has.fixedWidth - width, in PDF units, for each table columns.ReportGenerationException - in case of failure.beginTable(int, int...)public void endTable()
throws ReportGenerationException
ReportGenerationExceptionpublic void addTableHeaderRow(List<String> header) throws ReportGenerationException
header - list with each column title.ReportGenerationExceptionpublic void beginTableHeaderRow()
throws ReportGenerationException
ReportGenerationExceptionpublic void addTableHeaderCell(String columnName) throws ReportGenerationException
columnName - column title.ReportGenerationExceptionpublic void addTableHeaderCell(String columnName, int colspan) throws ReportGenerationException
columnName - title of the column.colspan - number of columns the title should occupy. Equals to 1 to represent a single column title.ReportGenerationExceptionpublic void endTableHeaderRow()
throws ReportGenerationException
ReportGenerationExceptionpublic void addTableRow(List<String> cells) throws ReportGenerationException
beginTableRow(), addTableCell(String)'s endTableRow() instead
of this.cells - list with all cells of the line (according to their columns).ReportGenerationExceptionpublic void beginTableRow()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginTableCell()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginTableCell(int colspan,
int rowspan)
throws ReportGenerationException
colspan - number of columns occupied by the cell.rowspan - number of rows occupied by the cell.ReportGenerationExceptionpublic void addTableCell(String element, int colspan, int rowspan) throws ReportGenerationException
element - cell's text.colspan - number of columns occupied by the cell.rowspan - number of rows occupied by the cell.ReportGenerationExceptionpublic void addTableCell(String element) throws ReportGenerationException
beginTableCell() - addText(java.lang.String) - endTableCell() sequence, of adding
single text to a table cell.element - cell's text.ReportGenerationExceptionpublic void endTableCell()
throws ReportGenerationException
ReportGenerationExceptionpublic void endTableRow()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginGroup(ReportGroupType type) throws ReportGenerationException
type - type of the group to begin.ReportGenerationExceptionpublic void beginGroup(ReportGroupType type, String name) throws ReportGenerationException
type - type of the group to begin.name - optional name of the group (could be null).ReportGenerationExceptionpublic void endGroup()
throws ReportGenerationException
ReportGenerationExceptionpublic void addCurrentPageNumber()
throws ReportGenerationException
ReportGenerationExceptionprotected boolean isInsideHeaderOrFooter()
public void addTotalPagesCount()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginPageHeaderLeft()
throws ReportGenerationException
ReportGenerationExceptionpublic void endPageHeaderLeft()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginPageHeaderCenter()
throws ReportGenerationException
ReportGenerationExceptionpublic void endPageHeaderCenter()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginPageHeaderRight()
throws ReportGenerationException
ReportGenerationExceptionpublic void endPageHeaderRight()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginPageFooterLeft()
throws ReportGenerationException
ReportGenerationExceptionpublic void endPageFooterLeft()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginPageFooterCenter()
throws ReportGenerationException
ReportGenerationExceptionpublic void endPageFooterCenter()
throws ReportGenerationException
ReportGenerationExceptionpublic void beginPageFooterRight()
throws ReportGenerationException
ReportGenerationExceptionpublic void endPageFooterRight()
throws ReportGenerationException
ReportGenerationExceptionpublic void addImage(byte[] img,
String imgName,
int width)
throws ReportGenerationException
img - image represented by a byte array.imgName - image name: must be unique per document and without spaces.width - width (in pixels) to display the image.ReportGenerationExceptionpublic void addImage(byte[] img,
String imgName,
int width,
int height)
throws ReportGenerationException
img - image represented by a byte array.imgName - image name: must be unique per document and without spaces.width - width (in pixels) to display the image.height - height (in pixels) to display the image. Could be with different aspect ratio of the
original image.ReportGenerationExceptionpublic void addLinkedImage(String imgLink, int width) throws ReportGenerationException
supportImagesOfJarFilesOrURLs()
is false, it's recommended to insert it - if not at header or footer - via
addImage(byte[], String, int), or to extract it to a file and insert via the path as link.imgLink - path to the image.width - width (in pixels) to display the image.ReportGenerationExceptionpublic void addLinkedImage(String imgLink, int width, int height) throws ReportGenerationException
supportImagesOfJarFilesOrURLs()
is false, it's recommended to insert it - if not at header or footer - via
addImage(byte[], String, int, int), or to extract it to a file and insert via the path as link.imgLink - path to the image.width - width (in pixels) to display the image.height - height (in pixels) to display the image. Obviously, could be with different aspect
ratio of the original image.ReportGenerationExceptionpublic void addLineSpaces(int n)
throws ReportGenerationException
n blank lines to the report.n - Number of blank lines to add.ReportGenerationExceptionpublic void addLineBreak()
throws ReportGenerationException
ReportGenerationExceptionpublic void addTextWithNullSupport(String text) throws ReportGenerationException
null and empty values with '-'.text - String with the text to append or null.ReportGenerationExceptionpublic void addText(String text) throws ReportGenerationException
addTextWithNullSupport(String).text - String with the text to append.ReportGenerationExceptionpublic void addTextLine(String line) throws ReportGenerationException
line - String with text to add.ReportGenerationExceptionpublic void addSeparatorLine()
throws ReportGenerationException
ReportGenerationExceptionprotected void checkDocumentNotFinished()
protected void checkNotOpenedFooterOrHeader()
IllegalStateException - if the top isn't one of those expected or null.protected void checkStackState(boolean pop,
net.sf.nervalreports.core.ReportGenerator.ReportBlockToken... expected)
pop - if will pop (true) or peek (false) the stack top to check.expected - valid expected types.IllegalStateException - if the top isn't one of those expected or null.EmptyStackException - if the command stack is empty.Copyright © 2018. All rights reserved.