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 Stringstatic final StringPrefix for JasperReports properties that specify properties to be transferred from report templates to print objects.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a new empty document.protectedJasperPrint(List<JRPrintPage> pages) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBookmark(PrintBookmark bookmark) Adds a new page to the document.voidAdds a new style to the report origins.voidaddPage(int index, JRPrintPage page) Adds a new page to the document, placing it at the specified index.voidaddPage(JRPrintPage page) Adds a new page to the document.voidAdds a new part to the document.voidAdds a new style to the report styles.voidAdds a new style to the report styles.protected voidcollectAnchors(Collection<JRPrintElement> elements, int pageIndex, int offsetX, int offsetY) voidcopyFrom(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 theFormatFactoryinterface to use with this document.Returns the code of the defaultjava.util.Localeto 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) intgetPages()Returns a list of all pages in the filled report.intReturns 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 theIDof the defaultjava.util.TimeZoneto be used for the elements of this print object.protected booleanbooleanhasParts()Determines whether this document contains parts.booleanChecks 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.voidremoveProperty(String propName) removeStyle(String styleName) removeStyle(JRStyle style) voidsetBookmarks(List<PrintBookmark> bookmarks) voidsetBottomMargin(Integer bottomMargin) Sets the bottom page margin.voidsetDefaultStyle(JRStyle style) Sets the default report style.voidsetFormatFactoryClass(String formatFactoryClass) Sets the name of the class implementing theFormatFactoryinterface to use with this document.voidsetJasperReportsContext(JasperReportsContext jasperReportsContext) voidsetLeftMargin(Integer leftMargin) Sets the left page margin.voidsetLocaleCode(String localeCode) Sets the the code of the defaultjava.util.Localeto be used for this object.voidSets the name of the document.voidsetOrientation(OrientationEnum orientation) Sets the page orientation.voidsetPageHeight(int pageHeight) Sets the page height.voidsetPageWidth(int pageWidth) Sets the page width.voidsetProperty(String propName, String value) voidsetRightMargin(Integer rightMargin) Sets the right page margin.voidsetTimeZoneId(String timeZoneId) Sets the theIDof the defaultjava.util.TimeZoneto be used for this object.voidsetTopMargin(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:JRPropertiesHolderChecks whether the object has any properties.- Specified by:
hasPropertiesin interfaceJRPropertiesHolder- Returns:
- whether the object has any properties
-
getPropertiesMap
Description copied from interface:JRPropertiesHolderReturns this object's properties map.- Specified by:
getPropertiesMapin interfaceJRPropertiesHolder- Returns:
- this object's properties map
-
getParentProperties
Description copied from interface:JRPropertiesHolderReturns the parent properties holder, whose properties are used as defaults for this object.- Specified by:
getParentPropertiesin interfaceJRPropertiesHolder- Returns:
- the parent properties holder, or
nullif 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 theFormatFactoryinterface to use with this document. -
setFormatFactoryClass
Sets the name of the class implementing theFormatFactoryinterface to use with this document. -
getLocaleCode
Returns the code of the defaultjava.util.Localeto be used for the elements of this print object.When filling a report, the value of the
REPORT_LOCALEparameter (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.Localefor this object - See Also:
-
setLocaleCode
Sets the the code of the defaultjava.util.Localeto be used for this object.- Parameters:
localeCode- the locale code, using thejava.util.Locale.toString()convention.- See Also:
-
getTimeZoneId
Returns theIDof the defaultjava.util.TimeZoneto be used for the elements of this print object.When filling a report, the value of the
REPORT_TIME_ZONEparameter (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.TimeZonefor this object - See Also:
-
setTimeZoneId
Sets the theIDof the defaultjava.util.TimeZoneto be used for this object.- Parameters:
timeZoneId- the time zone ID- See Also:
-
copyFrom
-
hasEventSupport
protected boolean hasEventSupport() -
getEventSupport
Description copied from interface:JRChangeEventsSupportReturns the property change support object for this instance.- Specified by:
getEventSupportin interfaceJRChangeEventsSupport- Returns:
- the property change support object for this instance
-