Class JRPptxExporter
- java.lang.Object
-
- net.sf.jasperreports.engine.JRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
-
- net.sf.jasperreports.engine.export.ooxml.JRPptxExporter
-
- All Implemented Interfaces:
JRExporter<ExporterInput,PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput>
,Exporter<ExporterInput,PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput>
public class JRPptxExporter extends JRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
Exports a JasperReports document to Microsoft PowerPoint 2007 format (PPTX). This exporter uses an absolute positioned layout and currently there is a single special configuration that can be applied to a PPTX exporter instance (seePptxReportConfiguration
) to configure its behavior: one can ignore hyperlinks in generated documents if they are not intended for the PPTX output format. This can be customized using either theisIgnoreHyperlink()
exporter configuration flag, or its corresponding exporter hint callednet.sf.jasperreports.export.pptx.ignore.hyperlink
. It supports font mappings, batch mode exporting, and filtering out content using exporter filters. Documents produced using this exporter can be generated in the great majority of the samples shipped with the JasperReports project source files, where thepptx
Ant task is defined.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
PptxReportConfiguration
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
JRPptxExporter.ExporterContext
-
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange
-
-
Field Summary
Fields Modifier and Type Field Description protected PropsAppHelper
appHelper
protected PropsCoreHelper
coreHelper
protected PptxContentTypesHelper
ctHelper
protected boolean
defaultFrameAsTable
protected int
elementIndex
static java.lang.String
EXCEPTION_MESSAGE_KEY_COLUMN_COUNT_OUT_OF_RANGE
static java.lang.String
FIELD_TYPE_DATETIME
static java.lang.String
FIELD_TYPE_SLIDENUM
protected PptxFontHelper
fontHelper
protected java.util.List<java.lang.Integer>
frameIndexStack
static java.lang.String
IMAGE_NAME_PREFIX
protected static int
IMAGE_NAME_PREFIX_LEGTH
protected java.lang.String
invalidCharReplacement
protected static java.lang.String
JR_PAGE_ANCHOR_PREFIX
protected int
pageIndex
static java.lang.String
PPTX_EXPORTER_KEY
The exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String)
.static java.lang.String
PPTX_EXPORTER_PROPERTIES_PREFIX
protected PptxZip
pptxZip
protected PptxPresentationHelper
presentationHelper
protected PptxPresentationRelsHelper
presentationRelsHelper
protected java.io.Writer
presentationRelsWriter
protected java.io.Writer
presentationWriter
static java.lang.String
PROPERTY_FIELD_TYPE
Property that specifies the field type associated with this element in the PPTX export.static java.lang.String
PROPERTY_TO_SLIDE_MASTER
Property that specifies if this element, when found on the first page of the document, should be exported into the slide master, and then ignored on all pages/slides.protected RenderersCache
renderersCache
protected java.util.Map<java.lang.String,Pair<java.lang.String,ExifOrientationEnum>>
rendererToImagePathMap
protected int
reportIndex
protected PptxSlideHelper
slideHelper
protected int
slideIndex
used for counting the total number of sheetsprotected PptxSlideRelsHelper
slideRelsHelper
-
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
allSelector, crtCompositeConfiguration, crtCompositeItemConfiguration, crtItem, dateFormatCache, EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME, EXCEPTION_MESSAGE_KEY_INVALID_ZOOM_RATIO, EXCEPTION_MESSAGE_KEY_MIXED_CALLS_NOT_ALLOWED, EXCEPTION_MESSAGE_KEY_OUTPUT_WRITER_ERROR, EXCEPTION_MESSAGE_KEY_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_START_PAGE_INDEX_OUT_OF_RANGE, exporterConfiguration, exporterContext, exporterInput, exporterOutput, filter, fontUtil, hyperlinkProducerFactory, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, parameters, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, rendererUtil, styledTextUtil, textValueClasses
-
-
Constructor Summary
Constructors Constructor Description JRPptxExporter()
JRPptxExporter(JasperReportsContext jasperReportsContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeSlide()
protected void
closeSlideMaster()
protected void
createSlide(boolean hideSlideMaster)
protected void
createSlideMaster()
protected void
ensureOutput()
protected void
exportElement(JRPrintElement element)
protected void
exportEllipse(JRPrintEllipse ellipse)
protected void
exportFrame(PptxTableHelper tableHelper, JRPrintFrame frame, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
Since in PPTX we only have deep grids, this is called only for empty frames.void
exportFrame(JRPrintFrame frame)
protected void
exportGenericElement(JRGenericPrintElement element)
protected void
exportGrid(JRGridLayout gridLayout)
void
exportImage(PptxTableHelper tableHelper, JRPrintImage image, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
void
exportImage(JRPrintImage image)
protected void
exportLine(PptxTableHelper tableHelper, JRPrintLine line, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
protected void
exportLine(JRPrintLine line)
protected void
exportPage(JRPrintPage page, boolean isBackgroundAsSlideMaster, boolean hasToSlideMasterElements)
protected boolean
exportPageToSlideMaster(JRPrintPage page, boolean isBackgroundAsSlideMaster)
protected void
exportPen(JRLineBox lineBox)
protected void
exportPen(JRPen pen)
protected void
exportRectangle(PptxTableHelper tableHelper, JRPrintGraphicElement rectangle, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
protected void
exportRectangle(JRPrintElement rectangle, JRPen pen, int radius)
protected void
exportRectangle(JRPrintRectangle rectangle)
void
exportReport()
Performs the export.protected void
exportReportToStream(java.io.OutputStream os)
protected void
exportStyledText(JRStyle style, JRStyledText styledText, java.util.Locale locale, java.lang.String fieldType, java.lang.String uuid)
void
exportText(PptxTableHelper tableHelper, JRPrintText text, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
void
exportText(JRPrintText text)
protected java.lang.Class<PptxExporterConfiguration>
getConfigurationInterface()
protected JRPrintElementIndex
getElementIndex()
protected JRPrintElementIndex
getElementIndex(JRExporterGridCell gridCell)
java.lang.String
getExporterKey()
java.lang.String
getExporterPropertiesPrefix()
Returns the properties prefix for the current exporter.protected java.lang.String
getHyperlinkTarget(JRPrintHyperlink link)
protected java.lang.String
getHyperlinkURL(JRPrintHyperlink link)
protected java.lang.Class<PptxReportConfiguration>
getItemConfigurationInterface()
protected JRPen
getPptxPen(JRLineBox box)
static JRPrintElementIndex
getPrintElementIndex(java.lang.String imageName)
protected JRStyledText
getStyledText(JRPrintText textElement, boolean setBackcolor)
protected void
initExport()
protected void
initReport()
protected boolean
isFrameAsTable(JRPrintFrame frame)
protected void
setBox4Cell(JRExporterGridCell gridCell)
protected void
setBox4Line(JRPrintLine line, JRExporterGridCell gridCell)
protected void
setBox4Rectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell)
protected java.lang.String
toOOXMLId(JRPrintElement element)
-
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
checkInterrupted, createFilter, defaultParseNumber, ensureInput, ensureJasperReportsContext, getBooleanCellValue, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getDateCellValue, getDateFormat, getExporterContext, getExporterInput, getExporterOutput, getHyperlinkProducer, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getParameter, getParameters, getPropertiesUtil, getRendererUtil, getReportContext, getRepository, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, insideFrame, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperReportsContext, setOffset, setOffset, setParameter, setParameters, setReportContext
-
-
-
-
Field Detail
-
PPTX_EXPORTER_KEY
public static final java.lang.String PPTX_EXPORTER_KEY
The exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String)
.- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_COLUMN_COUNT_OUT_OF_RANGE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_COLUMN_COUNT_OUT_OF_RANGE
- See Also:
- Constant Field Values
-
PPTX_EXPORTER_PROPERTIES_PREFIX
public static final java.lang.String PPTX_EXPORTER_PROPERTIES_PREFIX
- See Also:
- Constant Field Values
-
PROPERTY_TO_SLIDE_MASTER
public static final java.lang.String PROPERTY_TO_SLIDE_MASTER
Property that specifies if this element, when found on the first page of the document, should be exported into the slide master, and then ignored on all pages/slides.- See Also:
- Constant Field Values
-
PROPERTY_FIELD_TYPE
public static final java.lang.String PROPERTY_FIELD_TYPE
Property that specifies the field type associated with this element in the PPTX export. When this property is set, the element value will be automatically updated when the presentation is open.- slidenum - the current slide number will be displayed in this field
- datetime - the current date/time will be displayed in this field, according to some predefined patterns:
- MM/dd/yyyy
- EEEE, MMMM dd, yyyy
- dd MMMM yyyy
- MMMM dd, yyyy
- dd-MMM-yy
- MMMM yy
- MMM-yy
- MM/dd/yyyy hh:mm a
- MM/dd/yyyy hh:mm:ss a
- HH:mm
- HH:mm:ss
- hh:mm a
- hh:mm:ss a
- See Also:
- Constant Field Values
-
FIELD_TYPE_SLIDENUM
public static final java.lang.String FIELD_TYPE_SLIDENUM
- See Also:
- Constant Field Values
-
FIELD_TYPE_DATETIME
public static final java.lang.String FIELD_TYPE_DATETIME
- See Also:
- Constant Field Values
-
JR_PAGE_ANCHOR_PREFIX
protected static final java.lang.String JR_PAGE_ANCHOR_PREFIX
- See Also:
- Constant Field Values
-
IMAGE_NAME_PREFIX
public static final java.lang.String IMAGE_NAME_PREFIX
- See Also:
- Constant Field Values
-
IMAGE_NAME_PREFIX_LEGTH
protected static final int IMAGE_NAME_PREFIX_LEGTH
-
pptxZip
protected PptxZip pptxZip
-
fontHelper
protected PptxFontHelper fontHelper
-
presentationHelper
protected PptxPresentationHelper presentationHelper
-
presentationRelsHelper
protected PptxPresentationRelsHelper presentationRelsHelper
-
ctHelper
protected PptxContentTypesHelper ctHelper
-
appHelper
protected PropsAppHelper appHelper
-
coreHelper
protected PropsCoreHelper coreHelper
-
slideHelper
protected PptxSlideHelper slideHelper
-
slideRelsHelper
protected PptxSlideRelsHelper slideRelsHelper
-
presentationWriter
protected java.io.Writer presentationWriter
-
presentationRelsWriter
protected java.io.Writer presentationRelsWriter
-
rendererToImagePathMap
protected java.util.Map<java.lang.String,Pair<java.lang.String,ExifOrientationEnum>> rendererToImagePathMap
-
renderersCache
protected RenderersCache renderersCache
-
reportIndex
protected int reportIndex
-
pageIndex
protected int pageIndex
-
frameIndexStack
protected java.util.List<java.lang.Integer> frameIndexStack
-
elementIndex
protected int elementIndex
-
invalidCharReplacement
protected java.lang.String invalidCharReplacement
-
defaultFrameAsTable
protected boolean defaultFrameAsTable
-
slideIndex
protected int slideIndex
used for counting the total number of sheets
-
-
Constructor Detail
-
JRPptxExporter
public JRPptxExporter()
- See Also:
JRPptxExporter(JasperReportsContext)
-
JRPptxExporter
public JRPptxExporter(JasperReportsContext jasperReportsContext)
-
-
Method Detail
-
getConfigurationInterface
protected java.lang.Class<PptxExporterConfiguration> getConfigurationInterface()
-
getItemConfigurationInterface
protected java.lang.Class<PptxReportConfiguration> getItemConfigurationInterface()
-
ensureOutput
protected void ensureOutput()
- Specified by:
ensureOutput
in classJRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
-
exportReport
public void exportReport() throws JRException
Description copied from interface:Exporter
Performs the export.- Specified by:
exportReport
in interfaceExporter<ExporterInput,PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput>
- Specified by:
exportReport
in classJRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
- Throws:
JRException
-
initExport
protected void initExport()
-
initReport
protected void initReport()
-
exportReportToStream
protected void exportReportToStream(java.io.OutputStream os) throws JRException, java.io.IOException
- Throws:
JRException
java.io.IOException
-
exportPageToSlideMaster
protected boolean exportPageToSlideMaster(JRPrintPage page, boolean isBackgroundAsSlideMaster) throws JRException
- Throws:
JRException
-
exportPage
protected void exportPage(JRPrintPage page, boolean isBackgroundAsSlideMaster, boolean hasToSlideMasterElements) throws JRException
- Throws:
JRException
-
createSlideMaster
protected void createSlideMaster()
-
createSlide
protected void createSlide(boolean hideSlideMaster)
-
closeSlideMaster
protected void closeSlideMaster()
-
closeSlide
protected void closeSlide()
-
exportElement
protected void exportElement(JRPrintElement element) throws JRException
- Throws:
JRException
-
exportLine
protected void exportLine(JRPrintLine line)
-
exportPen
protected void exportPen(JRPen pen)
-
exportRectangle
protected void exportRectangle(JRPrintRectangle rectangle)
-
exportRectangle
protected void exportRectangle(JRPrintElement rectangle, JRPen pen, int radius)
-
exportEllipse
protected void exportEllipse(JRPrintEllipse ellipse)
-
exportText
public void exportText(JRPrintText text)
-
exportPen
protected void exportPen(JRLineBox lineBox)
-
exportStyledText
protected void exportStyledText(JRStyle style, JRStyledText styledText, java.util.Locale locale, java.lang.String fieldType, java.lang.String uuid)
-
exportImage
public void exportImage(JRPrintImage image) throws JRException
- Throws:
JRException
-
getElementIndex
protected JRPrintElementIndex getElementIndex()
-
getElementIndex
protected JRPrintElementIndex getElementIndex(JRExporterGridCell gridCell)
-
getPrintElementIndex
public static JRPrintElementIndex getPrintElementIndex(java.lang.String imageName)
-
exportFrame
public void exportFrame(JRPrintFrame frame) throws JRException
- Throws:
JRException
-
exportFrame
protected void exportFrame(PptxTableHelper tableHelper, JRPrintFrame frame, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell) throws JRException
Since in PPTX we only have deep grids, this is called only for empty frames.- Throws:
JRException
-
exportGrid
protected void exportGrid(JRGridLayout gridLayout) throws JRException
- Throws:
JRException
-
exportLine
protected void exportLine(PptxTableHelper tableHelper, JRPrintLine line, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
-
setBox4Line
protected void setBox4Line(JRPrintLine line, JRExporterGridCell gridCell)
-
exportRectangle
protected void exportRectangle(PptxTableHelper tableHelper, JRPrintGraphicElement rectangle, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
-
setBox4Rectangle
protected void setBox4Rectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell)
-
setBox4Cell
protected void setBox4Cell(JRExporterGridCell gridCell)
-
exportImage
public void exportImage(PptxTableHelper tableHelper, JRPrintImage image, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell) throws JRException
- Throws:
JRException
-
exportText
public void exportText(PptxTableHelper tableHelper, JRPrintText text, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)
-
exportGenericElement
protected void exportGenericElement(JRGenericPrintElement element)
-
getHyperlinkTarget
protected java.lang.String getHyperlinkTarget(JRPrintHyperlink link)
-
getHyperlinkURL
protected java.lang.String getHyperlinkURL(JRPrintHyperlink link)
-
getStyledText
protected JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor)
-
getExporterKey
public java.lang.String getExporterKey()
- Specified by:
getExporterKey
in classJRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
-
getExporterPropertiesPrefix
public java.lang.String getExporterPropertiesPrefix()
Description copied from class:JRAbstractExporter
Returns the properties prefix for the current exporter.- Specified by:
getExporterPropertiesPrefix
in classJRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
- Returns:
- the properties prefix for the current exporter
-
toOOXMLId
protected java.lang.String toOOXMLId(JRPrintElement element)
-
isFrameAsTable
protected boolean isFrameAsTable(JRPrintFrame frame)
-
-