public class JRXmlWriter extends JRXmlBaseWriter
Sometimes report designs are generated automatically using the JasperReports API. Report design objects obtained this way can be serialized for disk storage or transferred over the network, but they also can be stored in JRXML format.
The JRXML representation of a given report design object can be obtained by using one
of the public static writeReport() methods exposed by this class.
| Modifier and Type | Field and Description |
|---|---|
static String |
EXCEPTION_MESSAGE_KEY_FILE_WRITE_ERROR |
static String |
EXCEPTION_MESSAGE_KEY_OUTPUT_STREAM_WRITE_ERROR |
static String |
EXCEPTION_MESSAGE_KEY_REPORT_DESIGN_WRITE_ERROR |
static String |
EXCEPTION_MESSAGE_KEY_UNSUPPORTED_CHART_TYPE |
static XmlNamespace |
JASPERREPORTS_NAMESPACE |
static String |
PREFIX_EXCLUDE_PROPERTIES |
PROPERTY_REPORT_VERSION, version, versionComparator, writer| Modifier | Constructor and Description |
|---|---|
|
JRXmlWriter(JasperReportsContext jasperReportsContext) |
protected |
JRXmlWriter(JRReport report,
String encoding)
Deprecated.
To be removed.
|
| Modifier and Type | Method and Description |
|---|---|
protected XmlNamespace |
getNamespace() |
JRReport |
getReport() |
Writer |
getUnderlyingWriter()
Returns the underlying stream to which this writer outputs to.
|
JRXmlWriteHelper |
getXmlWriteHelper()
Returns the XML write helper used by this report writer.
|
protected boolean |
isPropertyToWrite(JRPropertiesHolder propertiesHolder,
String propertyName) |
protected boolean |
toWriteConditionalStyles()
Decides whether conditional styles are to be written.
|
void |
write(JRReport report,
OutputStream outputStream,
String encoding) |
String |
write(JRReport report,
String encoding) |
void |
write(JRReport report,
String destFileName,
String encoding) |
void |
writeAreaChart(JRChart chart) |
void |
writeAxisFormat(JRFont axisLabelFont,
Color axisLabelColor,
JRFont axisTickLabelFont,
Color axisTickLabelColor,
String axisTickLabelMask,
Boolean axisVerticalTickLabels,
Color axisLineColor)
Writes out the axis format block for a chart axis.
|
void |
writeAxisFormat(String axisFormatElementName,
JRFont axisLabelFont,
Color axisLabelColor,
JRFont axisTickLabelFont,
Color axisTickLabelColor,
String axisTickLabelMask,
Boolean axisVerticalTickLabels,
Color axisLineColor)
Writes out the axis format block for a chart axis.
|
void |
writeBar3DChart(JRChart chart) |
void |
writeBar3DPlot(JRBar3DPlot plot) |
void |
writeBarChart(JRChart chart) |
void |
writeBreak(JRBreak breakElement) |
void |
writeBubbleChart(JRChart chart) |
protected void |
writeBucket(JRCrosstabBucket bucket) |
void |
writeCandlestickChart(JRChart chart) |
void |
writeCategoryAxisFormat(JRFont axisLabelFont,
Color axisLabelColor,
JRFont axisTickLabelFont,
Color axisTickLabelColor,
String axisTickLabelMask,
Boolean axisVerticalTickLabels,
Double labelRotation,
Color axisLineColor)
Writes out the category axis format block.
|
protected void |
writeCellContents(JRCellContents contents) |
void |
writeChartTag(JRChart chart) |
void |
writeChildElements(JRElementGroup elementContainer)
Writes the contents (child elements) of an element container.
|
void |
writeComponentElement(JRComponentElement componentElement) |
void |
writeCrosstab(JRCrosstab crosstab) |
protected void |
writeCrosstabCell(JRCrosstabCell cell) |
protected void |
writeCrosstabColumnGroup(JRCrosstabColumnGroup group) |
protected void |
writeCrosstabMeasure(JRCrosstabMeasure measure) |
protected void |
writeCrosstabParameter(JRCrosstabParameter parameter) |
protected void |
writeCrosstabRowGroup(JRCrosstabRowGroup group) |
protected void |
writeDataLevelBucket(DataLevelBucket bucket) |
void |
writeDataRange(JRDataRange dataRange)
Writes a data range block to the output stream.
|
void |
writeDataset(JRDataset dataset) |
protected void |
writeDatasetContents(JRDataset dataset) |
void |
writeDatasetRun(JRDatasetRun datasetRun)
Outputs the XML representation of a subdataset run object.
|
void |
writeElementDataset(JRElementDataset dataset)
Writes the JRXML representation of an
element dataset. |
void |
writeElementDataset(JRElementDataset dataset,
boolean skipIfEmpty)
Writes the JRXML representation of an
element dataset. |
void |
writeElementDataset(JRElementDataset dataset,
ResetTypeEnum defaultResetType,
boolean skipIfEmpty)
Writes the JRXML representation of an
element dataset. |
void |
writeElementGroup(JRElementGroup elementGroup) |
void |
writeEllipse(JREllipse ellipse) |
protected void |
writeExpression(String name,
JRExpression expression,
boolean writeClass,
String defaultClassName) |
protected void |
writeExpression(String name,
XmlNamespace namespace,
JRExpression expression,
boolean writeClass) |
void |
writeFont(JRFont font) |
void |
writeFrame(JRFrame frame) |
void |
writeGanttChart(JRChart chart) |
void |
writeGenericElement(JRGenericElement element) |
void |
writeHighLowChart(JRChart chart) |
void |
writeHighLowDataset(JRHighLowDataset dataset) |
void |
writeHyperlink(String tagName,
JRHyperlink hyperlink) |
void |
writeHyperlink(String tagName,
XmlNamespace namespace,
JRHyperlink hyperlink) |
protected void |
writeHyperlinkParameter(JRHyperlinkParameter parameter) |
protected void |
writeHyperlinkParameters(JRHyperlinkParameter[] parameters) |
void |
writeImage(JRImage image) |
void |
writeItemLabel(JRItemLabel itemLabel)
Writes the description of how to display item labels in a category plot.
|
void |
writeLine(JRLine line) |
void |
writeLineChart(JRChart chart) |
void |
writeMeterChart(JRChart chart)
Writes the definition of a meter chart to the output stream.
|
void |
writeMultiAxisChart(JRChart chart)
Writes the definition of a multiple axis chart to the output stream.
|
void |
writeMultiAxisData(MultiAxisData data) |
void |
writePie3DChart(JRChart chart) |
void |
writePieChart(JRChart chart) |
void |
writePieDataset(JRPieDataset dataset) |
void |
writeProperties(JRPropertiesHolder propertiesHolder) |
protected void |
writePropertyExpression(JRPropertyExpression propertyExpression) |
void |
writePropertyExpressions(JRPropertyExpression[] propertyExpressions) |
void |
writeRectangle(JRRectangle rectangle) |
static void |
writeReport(JRReport report,
OutputStream outputStream,
String encoding) |
static String |
writeReport(JRReport report,
String encoding) |
static void |
writeReport(JRReport report,
String destFileName,
String encoding) |
protected void |
writeReport(JRReport report,
String encoding,
Writer out) |
protected void |
writeReport(Writer out)
Deprecated.
Replaced by
writeReport(JRReport, String, Writer). |
protected void |
writeReturnValue(ExpressionReturnValue returnValue) |
protected void |
writeReturnValue(VariableReturnValue returnValue) |
void |
writeScatterChart(JRChart chart) |
protected void |
writeSection(JRSection section) |
void |
writeStackedAreaChart(JRChart chart) |
void |
writeStackedBar3DChart(JRChart chart) |
void |
writeStackedBarChart(JRChart chart) |
void |
writeStaticText(JRStaticText staticText) |
void |
writeSubreport(JRSubreport subreport) |
void |
writeSubreportParameter(JRSubreportParameter subreportParameter,
XmlNamespace namespace) |
void |
writeSubreportReturnValue(JRSubreportReturnValue returnValue,
XmlNamespace namespace) |
protected void |
writeTemplate(JRReportTemplate template) |
protected void |
writeTemplates()
Deprecated.
Replaced by
writeTemplates(JRReport). |
protected void |
writeTemplates(JRReport report) |
void |
writeTextField(JRTextField textField) |
void |
writeThermometerChart(JRChart chart)
Writes the description of a thermometer chart to the output stream.
|
void |
writeTimeSeriesChart(JRChart chart) |
void |
writeValueDataset(JRValueDataset dataset)
Writes the description of a value dataset to the output stream.
|
void |
writeValueDisplay(JRValueDisplay valueDisplay)
Writes the description of how to display a value in a valueDataset.
|
void |
writeXyAreaChart(JRChart chart) |
void |
writeXyBarChart(JRChart chart) |
void |
writeXyLineChart(JRChart chart) |
isNewerVersionOrEqual, isOlderVersionThan, useWriter, writeBox, writeBox, writeConditionalStyle, writeExpression, writeParagraph, writeParagraph, writePen, writeStyle, writeStyleReferenceAttr, writeTabStoppublic static final XmlNamespace JASPERREPORTS_NAMESPACE
public static final String EXCEPTION_MESSAGE_KEY_FILE_WRITE_ERROR
public static final String EXCEPTION_MESSAGE_KEY_OUTPUT_STREAM_WRITE_ERROR
public static final String EXCEPTION_MESSAGE_KEY_REPORT_DESIGN_WRITE_ERROR
public static final String EXCEPTION_MESSAGE_KEY_UNSUPPORTED_CHART_TYPE
public static final String PREFIX_EXCLUDE_PROPERTIES
public JRXmlWriter(JasperReportsContext jasperReportsContext)
public JRReport getReport()
public void write(JRReport report, String destFileName, String encoding) throws JRException
JRExceptionpublic void write(JRReport report, OutputStream outputStream, String encoding) throws JRException
JRExceptionpublic static String writeReport(JRReport report, String encoding)
write(JRReport, String)public static void writeReport(JRReport report, String destFileName, String encoding) throws JRException
JRExceptionwrite(JRReport, String, String)public static void writeReport(JRReport report, OutputStream outputStream, String encoding) throws JRException
JRExceptionwrite(JRReport, OutputStream, String)protected void writeReport(JRReport report, String encoding, Writer out) throws IOException
IOExceptionprotected void writeReport(Writer out) throws IOException
writeReport(JRReport, String, Writer).IOExceptionpublic void writeProperties(JRPropertiesHolder propertiesHolder) throws IOException
IOExceptionprotected boolean isPropertyToWrite(JRPropertiesHolder propertiesHolder, String propertyName)
protected void writeTemplates(JRReport report) throws IOException
IOExceptionprotected void writeTemplates()
throws IOException
writeTemplates(JRReport).IOExceptionprotected void writeTemplate(JRReportTemplate template) throws IOException
template - IOExceptionprotected void writeSection(JRSection section) throws IOException
IOExceptionpublic void writeChildElements(JRElementGroup elementContainer)
elementContainer - the element containerpublic void writeElementGroup(JRElementGroup elementGroup) throws IOException
IOExceptionpublic void writeBreak(JRBreak breakElement) throws IOException
IOExceptionpublic void writeLine(JRLine line) throws IOException
IOExceptionpublic void writePropertyExpressions(JRPropertyExpression[] propertyExpressions) throws IOException
IOExceptionprotected void writePropertyExpression(JRPropertyExpression propertyExpression) throws IOException
IOExceptionpublic void writeRectangle(JRRectangle rectangle) throws IOException
IOExceptionpublic void writeEllipse(JREllipse ellipse) throws IOException
IOExceptionpublic void writeImage(JRImage image) throws IOException
IOExceptionpublic void writeStaticText(JRStaticText staticText) throws IOException
IOExceptionpublic void writeFont(JRFont font) throws IOException
IOExceptionpublic void writeTextField(JRTextField textField) throws IOException
IOExceptionpublic void writeSubreport(JRSubreport subreport) throws IOException
IOExceptionpublic void writeSubreportParameter(JRSubreportParameter subreportParameter, XmlNamespace namespace) throws IOException
IOExceptionpublic void writeElementDataset(JRElementDataset dataset) throws IOException
element dataset.
The method produces a <dataset> XML element.
dataset - the element datasetIOException - any I/O exception that occurred while writing the
XML outputpublic void writeElementDataset(JRElementDataset dataset, boolean skipIfEmpty) throws IOException
element dataset.
The method produces a <dataset> XML element.
dataset - the element datasetskipIfEmpty - if set, no output will be produced if the element dataset
only has default attribute valuesIOException - any I/O exception that occurred while writing the
XML outputpublic void writeElementDataset(JRElementDataset dataset, ResetTypeEnum defaultResetType, boolean skipIfEmpty) throws IOException
element dataset.
The method produces a <dataset> XML element.
dataset - the element datasetdefaultResetType - the default dataset reset typeskipIfEmpty - if set, no output will be produced if the element dataset
only has default attribute valuesIOException - any I/O exception that occurred while writing the
XML outputpublic void writePieDataset(JRPieDataset dataset) throws IOException
IOExceptionpublic void writeValueDataset(JRValueDataset dataset) throws IOException
dataset - the value dataset to persistIOExceptionpublic void writeValueDisplay(JRValueDisplay valueDisplay) throws IOException
valueDisplay - the description to saveIOExceptionpublic void writeItemLabel(JRItemLabel itemLabel) throws IOException
itemLabel - the description to saveIOExceptionpublic void writeDataRange(JRDataRange dataRange) throws IOException
dataRange - the range to writeIOExceptionpublic void writePieChart(JRChart chart) throws IOException
IOExceptionpublic void writePie3DChart(JRChart chart) throws IOException
IOExceptionpublic void writeCategoryAxisFormat(JRFont axisLabelFont, Color axisLabelColor, JRFont axisTickLabelFont, Color axisTickLabelColor, String axisTickLabelMask, Boolean axisVerticalTickLabels, Double labelRotation, Color axisLineColor) throws IOException
axisLabelFont - font to use for the axis labelaxisLabelColor - color to use for the axis labelaxisTickLabelFont - font to use for the label of each tick markaxisTickLabelColor - color to use for the label of each tick markaxisTickLabelMask - formatting mask to use for the label of each tick markaxisVerticalTickLabels - flag to render tick labels at 90 degreeslabelRotation - label rotation angleaxisLineColor - the color to use for the axis line and any tick marksIOExceptionpublic void writeAxisFormat(String axisFormatElementName, JRFont axisLabelFont, Color axisLabelColor, JRFont axisTickLabelFont, Color axisTickLabelColor, String axisTickLabelMask, Boolean axisVerticalTickLabels, Color axisLineColor) throws IOException
axisFormatElementName - the name of the axis format element being writtenaxisLabelFont - font to use for the axis labelaxisLabelColor - color to use for the axis labelaxisTickLabelFont - font to use for the label of each tick markaxisTickLabelColor - color to use for the label of each tick markaxisTickLabelMask - formatting mask to use for the label of each tick markaxisVerticalTickLabels - flag to render tick labels at 90 degreesaxisLineColor - the color to use for the axis line and any tick marksIOExceptionpublic void writeAxisFormat(JRFont axisLabelFont, Color axisLabelColor, JRFont axisTickLabelFont, Color axisTickLabelColor, String axisTickLabelMask, Boolean axisVerticalTickLabels, Color axisLineColor) throws IOException
axisLabelFont - font to use for the axis labelaxisLabelColor - color to use for the axis labelaxisTickLabelFont - font to use for the label of each tick markaxisTickLabelColor - color to use for the label of each tick markaxisTickLabelMask - formatting mask to use for the label of each tick markaxisVerticalTickLabels - flag to render tick labels at 90 degreesaxisLineColor - the color to use for the axis line and any tick marksIOExceptionpublic void writeBar3DPlot(JRBar3DPlot plot) throws IOException
IOExceptionpublic void writeBarChart(JRChart chart) throws IOException
IOExceptionpublic void writeBar3DChart(JRChart chart) throws IOException
IOExceptionpublic void writeBubbleChart(JRChart chart) throws IOException
IOExceptionpublic void writeStackedBarChart(JRChart chart) throws IOException
IOExceptionpublic void writeStackedBar3DChart(JRChart chart) throws IOException
IOExceptionpublic void writeLineChart(JRChart chart) throws IOException
IOExceptionpublic void writeTimeSeriesChart(JRChart chart) throws IOException
IOExceptionpublic void writeHighLowDataset(JRHighLowDataset dataset) throws IOException
IOExceptionpublic void writeHighLowChart(JRChart chart) throws IOException
IOExceptionpublic void writeGanttChart(JRChart chart) throws IOException
IOExceptionpublic void writeCandlestickChart(JRChart chart) throws IOException
IOExceptionpublic void writeAreaChart(JRChart chart) throws IOException
IOExceptionpublic void writeScatterChart(JRChart chart) throws IOException
IOExceptionpublic void writeXyAreaChart(JRChart chart) throws IOException
IOExceptionpublic void writeXyBarChart(JRChart chart) throws IOException
IOExceptionpublic void writeXyLineChart(JRChart chart) throws IOException
IOExceptionpublic void writeMeterChart(JRChart chart) throws IOException
chart - the meter chart to writeIOExceptionpublic void writeThermometerChart(JRChart chart) throws IOException
chart - the thermometer chart to writeIOExceptionpublic void writeMultiAxisChart(JRChart chart) throws IOException
chart - the multiple axis chart to writeIOExceptionpublic void writeStackedAreaChart(JRChart chart) throws IOException
IOExceptionpublic void writeChartTag(JRChart chart) throws IOException
IOExceptionpublic void writeSubreportReturnValue(JRSubreportReturnValue returnValue, XmlNamespace namespace) throws IOException
IOExceptionprotected void writeReturnValue(VariableReturnValue returnValue) throws IOException
IOExceptionprotected void writeReturnValue(ExpressionReturnValue returnValue) throws IOException
IOExceptionpublic void writeCrosstab(JRCrosstab crosstab) throws IOException
IOExceptionprotected void writeCrosstabRowGroup(JRCrosstabRowGroup group) throws IOException
IOExceptionprotected void writeCrosstabColumnGroup(JRCrosstabColumnGroup group) throws IOException
IOExceptionprotected void writeBucket(JRCrosstabBucket bucket) throws IOException
IOExceptionprotected void writeCrosstabMeasure(JRCrosstabMeasure measure) throws IOException
IOExceptionprotected void writeCrosstabCell(JRCrosstabCell cell) throws IOException
IOExceptionprotected void writeCellContents(JRCellContents contents) throws IOException
IOExceptionprotected void writeCrosstabParameter(JRCrosstabParameter parameter) throws IOException
IOExceptionpublic void writeDataset(JRDataset dataset) throws IOException
IOExceptionprotected void writeDatasetContents(JRDataset dataset) throws IOException
IOExceptionpublic void writeDatasetRun(JRDatasetRun datasetRun) throws IOException
datasetRun - the subdataset runIOExceptionpublic void writeFrame(JRFrame frame) throws IOException
IOExceptionprotected void writeHyperlinkParameters(JRHyperlinkParameter[] parameters) throws IOException
IOExceptionprotected void writeHyperlinkParameter(JRHyperlinkParameter parameter) throws IOException
IOExceptionpublic void writeHyperlink(String tagName, JRHyperlink hyperlink) throws IOException
IOExceptionpublic void writeHyperlink(String tagName, XmlNamespace namespace, JRHyperlink hyperlink) throws IOException
IOExceptionprotected boolean toWriteConditionalStyles()
JRXmlBaseWritertoWriteConditionalStyles in class JRXmlBaseWriterpublic JRXmlWriteHelper getXmlWriteHelper()
public Writer getUnderlyingWriter()
public void writeComponentElement(JRComponentElement componentElement) throws IOException
IOExceptionprotected XmlNamespace getNamespace()
public void writeGenericElement(JRGenericElement element) throws IOException
IOExceptionpublic void writeMultiAxisData(MultiAxisData data) throws IOException
IOExceptionprotected void writeDataLevelBucket(DataLevelBucket bucket) throws IOException
IOExceptionprotected void writeExpression(String name, JRExpression expression, boolean writeClass, String defaultClassName) throws IOException
IOExceptionprotected void writeExpression(String name, XmlNamespace namespace, JRExpression expression, boolean writeClass) throws IOException
IOExceptionCopyright © 2017. All rights reserved.