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 thepptxAnt task is defined.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
PptxReportConfiguration
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJRPptxExporter.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 PropsAppHelperappHelperprotected PropsCoreHelpercoreHelperprotected PptxContentTypesHelperctHelperprotected booleandefaultFrameAsTableprotected intelementIndexstatic java.lang.StringEXCEPTION_MESSAGE_KEY_COLUMN_COUNT_OUT_OF_RANGEstatic java.lang.StringFIELD_TYPE_DATETIMEstatic java.lang.StringFIELD_TYPE_SLIDENUMprotected PptxFontHelperfontHelperprotected java.util.List<java.lang.Integer>frameIndexStackstatic java.lang.StringIMAGE_NAME_PREFIXprotected static intIMAGE_NAME_PREFIX_LEGTHprotected java.lang.StringinvalidCharReplacementprotected static java.lang.StringJR_PAGE_ANCHOR_PREFIXprotected intpageIndexstatic java.lang.StringPPTX_EXPORTER_KEYThe exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String).static java.lang.StringPPTX_EXPORTER_PROPERTIES_PREFIXprotected PptxZippptxZipprotected PptxPresentationHelperpresentationHelperprotected PptxPresentationRelsHelperpresentationRelsHelperprotected java.io.WriterpresentationRelsWriterprotected java.io.WriterpresentationWriterstatic java.lang.StringPROPERTY_FIELD_TYPEProperty that specifies the field type associated with this element in the PPTX export.static java.lang.StringPROPERTY_TO_SLIDE_MASTERProperty 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 RenderersCacherenderersCacheprotected java.util.Map<java.lang.String,Pair<java.lang.String,ExifOrientationEnum>>rendererToImagePathMapprotected intreportIndexprotected PptxSlideHelperslideHelperprotected intslideIndexused for counting the total number of sheetsprotected PptxSlideRelsHelperslideRelsHelper-
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 voidcloseSlide()protected voidcloseSlideMaster()protected voidcreateSlide(boolean hideSlideMaster)protected voidcreateSlideMaster()protected voidensureOutput()protected voidexportElement(JRPrintElement element)protected voidexportEllipse(JRPrintEllipse ellipse)protected voidexportFrame(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.voidexportFrame(JRPrintFrame frame)protected voidexportGenericElement(JRGenericPrintElement element)protected voidexportGrid(JRGridLayout gridLayout)voidexportImage(PptxTableHelper tableHelper, JRPrintImage image, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)voidexportImage(JRPrintImage image)protected voidexportLine(PptxTableHelper tableHelper, JRPrintLine line, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)protected voidexportLine(JRPrintLine line)protected voidexportPage(JRPrintPage page, boolean isBackgroundAsSlideMaster, boolean hasToSlideMasterElements)protected booleanexportPageToSlideMaster(JRPrintPage page, boolean isBackgroundAsSlideMaster)protected voidexportPen(JRLineBox lineBox)protected voidexportPen(JRPen pen)protected voidexportRectangle(PptxTableHelper tableHelper, JRPrintGraphicElement rectangle, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)protected voidexportRectangle(JRPrintElement rectangle, JRPen pen, int radius)protected voidexportRectangle(JRPrintRectangle rectangle)voidexportReport()Performs the export.protected voidexportReportToStream(java.io.OutputStream os)protected voidexportStyledText(JRStyle style, JRStyledText styledText, java.util.Locale locale, java.lang.String fieldType, java.lang.String uuid)voidexportText(PptxTableHelper tableHelper, JRPrintText text, JRExporterGridCell gridCell, JRExporterGridCell topGridCell, JRExporterGridCell leftGridCell, JRExporterGridCell rightGridCell, JRExporterGridCell bottomGridCell)voidexportText(JRPrintText text)protected java.lang.Class<PptxExporterConfiguration>getConfigurationInterface()protected JRPrintElementIndexgetElementIndex()protected JRPrintElementIndexgetElementIndex(JRExporterGridCell gridCell)java.lang.StringgetExporterKey()java.lang.StringgetExporterPropertiesPrefix()Returns the properties prefix for the current exporter.protected java.lang.StringgetHyperlinkTarget(JRPrintHyperlink link)protected java.lang.StringgetHyperlinkURL(JRPrintHyperlink link)protected java.lang.Class<PptxReportConfiguration>getItemConfigurationInterface()protected JRPengetPptxPen(JRLineBox box)static JRPrintElementIndexgetPrintElementIndex(java.lang.String imageName)protected JRStyledTextgetStyledText(JRPrintText textElement, boolean setBackcolor)protected voidinitExport()protected voidinitReport()protected booleanisFrameAsTable(JRPrintFrame frame)protected voidsetBox4Cell(JRExporterGridCell gridCell)protected voidsetBox4Line(JRPrintLine line, JRExporterGridCell gridCell)protected voidsetBox4Rectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell)protected java.lang.StringtoOOXMLId(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:
ensureOutputin classJRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
-
exportReport
public void exportReport() throws JRExceptionDescription copied from interface:ExporterPerforms the export.- Specified by:
exportReportin interfaceExporter<ExporterInput,PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput>- Specified by:
exportReportin 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:
JRExceptionjava.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:
getExporterKeyin classJRAbstractExporter<PptxReportConfiguration,PptxExporterConfiguration,OutputStreamExporterOutput,JRPptxExporterContext>
-
getExporterPropertiesPrefix
public java.lang.String getExporterPropertiesPrefix()
Description copied from class:JRAbstractExporterReturns the properties prefix for the current exporter.- Specified by:
getExporterPropertiesPrefixin 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)
-
-