Class JasperPrint
- All Implemented Interfaces:
Serializable
,JRChangeEventsSupport
,JRPropertiesHolder
- Direct Known Subclasses:
ReadOnlyPartJasperPrint
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.
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
Prefix for JasperReports properties that specify properties to be transferred from report templates to print objects.static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a new empty document.protected
JasperPrint
(List<JRPrintPage> pages) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBookmark
(PrintBookmark bookmark) Adds a new page to the document.void
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
Adds a new part to the document.void
Adds a new style to the report styles.void
Adds a new style to the report styles.protected void
collectAnchors
(Collection<JRPrintElement> elements, int pageIndex, int offsetX, int offsetY) void
copyFrom
(JasperPrint jasperPrint) Returns the default report style.When we want to virtualize pages, we want a style provider that is not the print object itself.Returns the property change support object for this instance.Returns the name of the class implementing theFormatFactory
interface to use with this document.Returns the code of the defaultjava.util.Locale
to be used for the elements of this print object.getName()
Returns the page orientation.JROrigin[]
Gets an array of report origins.Gets a list of report origins.Gets a map of report origins.getPageFormat
(int pageIndex) int
getPages()
Returns a list of all pages in the filled report.int
Returns the parent properties holder, whose properties are used as defaults for this object.getParts()
Returns a list of all parts in the filled report.Returns this object's properties map.getProperty
(String propName) String[]
JRStyle[]
Gets an array of report styles.Gets a list of report styles.Gets a map of report styles.Returns theID
of the defaultjava.util.TimeZone
to be used for the elements of this print object.protected boolean
boolean
hasParts()
Determines whether this document contains parts.boolean
Checks whether the object has any properties.removeOrigin
(JROrigin origin) removePage
(int index) Removes a page from the document.removePart
(int pageIndex) Removes a part from the document.void
removeProperty
(String propName) removeStyle
(String styleName) removeStyle
(JRStyle style) 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 theFormatFactory
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 defaultjava.util.Locale
to be used for this object.void
Sets the name of the document.void
setOrientation
(OrientationEnum orientation) 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 theID
of the defaultjava.util.TimeZone
to be used for this object.void
setTopMargin
(Integer topMargin) Sets the top page margin.
-
Field Details
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_STYLE
- See Also:
-
PROPERTIES_PRINT_TRANSFER_PREFIX
Prefix for JasperReports properties that specify properties to be transferred from report templates to print objects.- See Also:
-
PROPERTY_CREATE_BOOKMARKS
- See Also:
-
PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS
- See Also:
-
PROPERTY_NAME
- See Also:
-
PROPERTY_PAGE_WIDTH
- See Also:
-
PROPERTY_PAGE_HEIGHT
- See Also:
-
PROPERTY_TOP_MARGIN
- See Also:
-
PROPERTY_LEFT_MARGIN
- See Also:
-
PROPERTY_BOTTOM_MARGIN
- See Also:
-
PROPERTY_RIGHT_MARGIN
- See Also:
-
PROPERTY_ORIENTATION
- See Also:
-
PROPERTY_STYLES
- See Also:
-
PROPERTY_ORIGINS
- See Also:
-
PROPERTY_PARTS
- See Also:
-
PROPERTY_PAGES
- See Also:
-
PROPERTY_BOOKMARKS
- See Also:
-
PROPERTY_FORMAT_FACTORY_CLASS
- See Also:
-
PROPERTY_LOCALE_CODE
- See Also:
-
PROPERTY_TIME_ZONE_ID
- See Also:
-
-
Constructor Details
-
JasperPrint
public JasperPrint()Creates a new empty document. -
JasperPrint
-
-
Method Details
-
setJasperReportsContext
-
getName
- Returns:
- Returns the name of the document
-
setName
Sets the name of the document.- Parameters:
name
- name of the document
-
getPageFormat
- Returns:
- Returns the page format for specified page index.
-
getPageFormat
-
getPageWidth
public int getPageWidth()- Returns:
- Returns the page width
-
setPageWidth
public void setPageWidth(int pageWidth) Sets the page width.- Parameters:
pageWidth
- page width
-
getPageHeight
public int getPageHeight()- Returns:
- Returns the page height.
-
setPageHeight
public void setPageHeight(int pageHeight) Sets the page height.- Parameters:
pageHeight
- page height
-
getTopMargin
- Returns:
- Returns the top page margin
-
setTopMargin
Sets the top page margin.- Parameters:
topMargin
- top page margin
-
getLeftMargin
- Returns:
- Returns the left page margin
-
setLeftMargin
Sets the left page margin.- Parameters:
leftMargin
- left page margin
-
getBottomMargin
- Returns:
- Returns the bottom page margin
-
setBottomMargin
Sets the bottom page margin.- Parameters:
bottomMargin
- bottom page margin
-
getRightMargin
- Returns:
- Returns the right page margin
-
setRightMargin
Sets the right page margin.- Parameters:
rightMargin
- right page margin
-
getOrientation
Returns the page orientation.- See Also:
-
setOrientation
Sets the page orientation.- See Also:
-
hasProperties
public boolean hasProperties()Description copied from interface:JRPropertiesHolder
Checks whether the object has any properties.- Specified by:
hasProperties
in interfaceJRPropertiesHolder
- Returns:
- whether the object has any properties
-
getPropertiesMap
Description copied from interface:JRPropertiesHolder
Returns this object's properties map.- Specified by:
getPropertiesMap
in interfaceJRPropertiesHolder
- Returns:
- this object's properties map
-
getParentProperties
Description copied from interface:JRPropertiesHolder
Returns the parent properties holder, whose properties are used as defaults for this object.- Specified by:
getParentProperties
in interfaceJRPropertiesHolder
- Returns:
- the parent properties holder, or
null
if no parent
-
getPropertyNames
-
getProperty
-
setProperty
-
removeProperty
-
getDefaultStyle
Returns the default report style. -
setDefaultStyle
Sets the default report style. -
getDefaultStyleProvider
When we want to virtualize pages, we want a style provider that is not the print object itself. -
getStyles
Gets an array of report styles. -
getStylesList
Gets a list of report styles. -
getStylesMap
Gets a map of report styles. -
addStyle
Adds a new style to the report styles.- Throws:
JRException
-
addStyle
Adds a new style to the report styles.- Throws:
JRException
-
removeStyle
-
removeStyle
-
getOrigins
Gets an array of report origins. -
getOriginsList
Gets a list of report origins. -
getOriginsMap
Gets a map of report origins. -
addOrigin
Adds a new style to the report origins. -
removeOrigin
-
hasParts
public boolean hasParts()Determines whether this document contains parts.- Returns:
- whether this document contains parts
- See Also:
-
getParts
Returns a list of all parts in the filled report. -
addPart
Adds a new part to the document. -
removePart
Removes a part from the document. -
getPages
Returns a list of all pages in the filled report. -
addPage
Adds a new page to the document. -
addPage
Adds a new page to the document, placing it at the specified index. -
removePage
Removes a page from the document. -
getBookmarks
-
addBookmark
Adds a new page to the document. -
setBookmarks
-
getAnchorIndexes
-
collectAnchors
protected void collectAnchors(Collection<JRPrintElement> elements, int pageIndex, int offsetX, int offsetY) -
getFormatFactoryClass
Returns the name of the class implementing theFormatFactory
interface to use with this document. -
setFormatFactoryClass
Sets the name of the class implementing theFormatFactory
interface to use with this document. -
getLocaleCode
Returns the code of the defaultjava.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.- Returns:
- the code of the default
java.util.Locale
for this object - See Also:
-
setLocaleCode
Sets the the code of the defaultjava.util.Locale
to be used for this object.- Parameters:
localeCode
- the locale code, using thejava.util.Locale.toString()
convention.- See Also:
-
getTimeZoneId
Returns theID
of the defaultjava.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.- Returns:
- the ID of the default
java.util.TimeZone
for this object - See Also:
-
setTimeZoneId
Sets the theID
of the defaultjava.util.TimeZone
to be used for this object.- Parameters:
timeZoneId
- the time zone ID- See Also:
-
copyFrom
-
hasEventSupport
protected boolean hasEventSupport() -
getEventSupport
Description copied from interface:JRChangeEventsSupport
Returns the property change support object for this instance.- Specified by:
getEventSupport
in interfaceJRChangeEventsSupport
- Returns:
- the property change support object for this instance
-