public class JasperPrint extends Object implements Serializable, JRPropertiesHolder
When filling report designs with data, the engine produces instances of this class and these can be transferred over the network, stored in a serialized form on disk or exported to various other formats like PDF, HTML, XLS, CSV or XML.
Modifier and Type | Field and Description |
---|---|
static String |
EXCEPTION_MESSAGE_KEY_DUPLICATE_STYLE |
static String |
PROPERTIES_PRINT_TRANSFER_PREFIX
Prefix for JasperReports properties that specify properties to be
transfered from report templates to print objects.
|
static String |
PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS |
static String |
PROPERTY_CREATE_BOOKMARKS |
Constructor and Description |
---|
JasperPrint()
Creates a new empty document.
|
Modifier and Type | Method and Description |
---|---|
void |
addBookmark(PrintBookmark bookmark)
Adds a new page to the document.
|
void |
addOrigin(JROrigin origin)
Adds a new style to the report origins.
|
void |
addPage(int index,
JRPrintPage page)
Adds a new page to the document, placing it at the specified index.
|
void |
addPage(JRPrintPage page)
Adds a new page to the document.
|
void |
addPart(int pageIndex,
PrintPart part)
Adds a new part to the document.
|
void |
addStyle(JRStyle style)
Adds a new style to the report styles.
|
void |
addStyle(JRStyle style,
boolean isIgnoreDuplicate)
Adds a new style to the report styles.
|
protected void |
collectAnchors(Collection<JRPrintElement> elements,
int pageIndex,
int offsetX,
int offsetY) |
Map<String,JRPrintAnchorIndex> |
getAnchorIndexes() |
List<PrintBookmark> |
getBookmarks() |
Integer |
getBottomMargin() |
JRStyle |
getDefaultStyle()
Returns the default report style.
|
JRDefaultStyleProvider |
getDefaultStyleProvider()
When we want to virtualize pages, we want a style provider that
is not the print object itself.
|
String |
getFormatFactoryClass()
Returns the name of the class implementing the
FormatFactory
interface to use with this document. |
Integer |
getLeftMargin() |
String |
getLocaleCode()
Returns the code of the default
java.util.Locale to be used for the
elements of this print object. |
String |
getName() |
OrientationEnum |
getOrientationValue()
Returns the page orientation.
|
JROrigin[] |
getOrigins()
Gets an array of report origins.
|
List<JROrigin> |
getOriginsList()
Gets a list of report origins.
|
Map<JROrigin,Integer> |
getOriginsMap()
Gets a map of report origins.
|
PrintPageFormat |
getPageFormat() |
PrintPageFormat |
getPageFormat(int pageIndex) |
int |
getPageHeight() |
List<JRPrintPage> |
getPages()
Returns a list of all pages in the filled report.
|
int |
getPageWidth() |
JRPropertiesHolder |
getParentProperties()
Returns the parent properties holder, whose properties are used as defaults
for this object.
|
PrintParts |
getParts()
Returns a list of all parts in the filled report.
|
JRPropertiesMap |
getPropertiesMap()
Returns this object's properties map.
|
String |
getProperty(String propName) |
String[] |
getPropertyNames() |
Integer |
getRightMargin() |
JRStyle[] |
getStyles()
Gets an array of report styles.
|
List<JRStyle> |
getStylesList()
Gets a list of report styles.
|
Map<String,JRStyle> |
getStylesMap()
Gets a map of report styles.
|
String |
getTimeZoneId()
Returns the
ID of the default java.util.TimeZone
to be used for the elements of this print object. |
Integer |
getTopMargin() |
boolean |
hasParts()
Determines whether this document contains parts.
|
boolean |
hasProperties()
Checks whether the object has any properties.
|
JROrigin |
removeOrigin(JROrigin origin) |
JRPrintPage |
removePage(int index)
Removes a page from the document.
|
PrintPart |
removePart(int pageIndex)
Removes a part from the document.
|
void |
removeProperty(String propName) |
JRStyle |
removeStyle(JRStyle style) |
JRStyle |
removeStyle(String styleName) |
void |
setBookmarks(List<PrintBookmark> bookmarks) |
void |
setBottomMargin(Integer bottomMargin)
Sets the bottom page margin.
|
void |
setDefaultStyle(JRStyle style)
Sets the default report style.
|
void |
setFormatFactoryClass(String formatFactoryClass)
Sets the name of the class implementing the
FormatFactory
interface to use with this document. |
void |
setJasperReportsContext(JasperReportsContext jasperReportsContext) |
void |
setLeftMargin(Integer leftMargin)
Sets the left page margin.
|
void |
setLocaleCode(String localeCode)
Sets the the code of the default
java.util.Locale to be used for this object. |
void |
setName(String name)
Sets the name of the document.
|
void |
setOrientation(OrientationEnum orientationValue)
Sets the page orientation.
|
void |
setPageHeight(int pageHeight)
Sets the page height.
|
void |
setPageWidth(int pageWidth)
Sets the page width.
|
void |
setProperty(String propName,
String value) |
void |
setRightMargin(Integer rightMargin)
Sets the right page margin.
|
void |
setTimeZoneId(String timeZoneId)
Sets the the
ID of the default java.util.TimeZone
to be used for this object. |
void |
setTopMargin(Integer topMargin)
Sets the top page margin.
|
public static final String EXCEPTION_MESSAGE_KEY_DUPLICATE_STYLE
public static final String PROPERTIES_PRINT_TRANSFER_PREFIX
public static final String PROPERTY_CREATE_BOOKMARKS
public static final String PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS
public void setJasperReportsContext(JasperReportsContext jasperReportsContext)
public String getName()
public void setName(String name)
name
- name of the documentpublic PrintPageFormat getPageFormat(int pageIndex)
public PrintPageFormat getPageFormat()
public int getPageWidth()
public void setPageWidth(int pageWidth)
pageWidth
- page widthpublic int getPageHeight()
public void setPageHeight(int pageHeight)
pageHeight
- page heightpublic Integer getTopMargin()
public void setTopMargin(Integer topMargin)
topMargin
- top page marginpublic Integer getLeftMargin()
public void setLeftMargin(Integer leftMargin)
leftMargin
- left page marginpublic Integer getBottomMargin()
public void setBottomMargin(Integer bottomMargin)
bottomMargin
- bottom page marginpublic Integer getRightMargin()
public void setRightMargin(Integer rightMargin)
rightMargin
- right page marginpublic OrientationEnum getOrientationValue()
public void setOrientation(OrientationEnum orientationValue)
public boolean hasProperties()
JRPropertiesHolder
hasProperties
in interface JRPropertiesHolder
public JRPropertiesMap getPropertiesMap()
JRPropertiesHolder
getPropertiesMap
in interface JRPropertiesHolder
public JRPropertiesHolder getParentProperties()
JRPropertiesHolder
getParentProperties
in interface JRPropertiesHolder
null
if no parentpublic String[] getPropertyNames()
public void removeProperty(String propName)
public JRStyle getDefaultStyle()
public void setDefaultStyle(JRStyle style)
public JRDefaultStyleProvider getDefaultStyleProvider()
public JRStyle[] getStyles()
public void addStyle(JRStyle style) throws JRException
JRException
public void addStyle(JRStyle style, boolean isIgnoreDuplicate) throws JRException
JRException
public JROrigin[] getOrigins()
public void addOrigin(JROrigin origin)
public boolean hasParts()
getParts()
public PrintParts getParts()
public void addPart(int pageIndex, PrintPart part)
public PrintPart removePart(int pageIndex)
public List<JRPrintPage> getPages()
public void addPage(JRPrintPage page)
public void addPage(int index, JRPrintPage page)
public JRPrintPage removePage(int index)
public List<PrintBookmark> getBookmarks()
public void addBookmark(PrintBookmark bookmark)
public void setBookmarks(List<PrintBookmark> bookmarks)
public Map<String,JRPrintAnchorIndex> getAnchorIndexes()
protected void collectAnchors(Collection<JRPrintElement> elements, int pageIndex, int offsetX, int offsetY)
public String getFormatFactoryClass()
FormatFactory
interface to use with this document.public void setFormatFactoryClass(String formatFactoryClass)
FormatFactory
interface to use with this document.public String getLocaleCode()
java.util.Locale
to be used for the
elements of this print object.
When filling a report, the value of the REPORT_LOCALE
parameter
(or the default locale if the parameter has no explicit value)
is saved using this attribute. Some elements (e.g. elements rendered by a subreport)
in the print object can override this default locale.
java.util.Locale
for this objectJRPrintText.getLocaleCode()
public void setLocaleCode(String localeCode)
java.util.Locale
to be used for this object.localeCode
- the locale code, using the java.util.Locale.toString()
convention.getLocaleCode()
,
Locale.toString()
public String getTimeZoneId()
ID
of the default java.util.TimeZone
to be used for the elements of this print object.
When filling a report, the value of the REPORT_TIME_ZONE
parameter
(or the default time zine if the parameter has no explicit value)
is saved using this attribute. Some elements (e.g. elements rendered by a subreport)
in the print object can override this default time zone.
java.util.TimeZone
for this objectJRPrintText.getTimeZoneId()
public void setTimeZoneId(String timeZoneId)
ID
of the default java.util.TimeZone
to be used for this object.timeZoneId
- the time zone IDgetTimeZoneId()
,
TimeZone.getID()
Copyright © 2017. All rights reserved.