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, writeTabStop
public 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
JRException
public void write(JRReport report, OutputStream outputStream, String encoding) throws JRException
JRException
public static String writeReport(JRReport report, String encoding)
write(JRReport, String)
public static void writeReport(JRReport report, String destFileName, String encoding) throws JRException
JRException
write(JRReport, String, String)
public static void writeReport(JRReport report, OutputStream outputStream, String encoding) throws JRException
JRException
write(JRReport, OutputStream, String)
protected void writeReport(JRReport report, String encoding, Writer out) throws IOException
IOException
protected void writeReport(Writer out) throws IOException
writeReport(JRReport, String, Writer)
.IOException
public void writeProperties(JRPropertiesHolder propertiesHolder) throws IOException
IOException
protected boolean isPropertyToWrite(JRPropertiesHolder propertiesHolder, String propertyName)
protected void writeTemplates(JRReport report) throws IOException
IOException
protected void writeTemplates() throws IOException
writeTemplates(JRReport)
.IOException
protected void writeTemplate(JRReportTemplate template) throws IOException
template
- IOException
protected void writeSection(JRSection section) throws IOException
IOException
public void writeChildElements(JRElementGroup elementContainer)
elementContainer
- the element containerpublic void writeElementGroup(JRElementGroup elementGroup) throws IOException
IOException
public void writeBreak(JRBreak breakElement) throws IOException
IOException
public void writeLine(JRLine line) throws IOException
IOException
public void writePropertyExpressions(JRPropertyExpression[] propertyExpressions) throws IOException
IOException
protected void writePropertyExpression(JRPropertyExpression propertyExpression) throws IOException
IOException
public void writeRectangle(JRRectangle rectangle) throws IOException
IOException
public void writeEllipse(JREllipse ellipse) throws IOException
IOException
public void writeImage(JRImage image) throws IOException
IOException
public void writeStaticText(JRStaticText staticText) throws IOException
IOException
public void writeFont(JRFont font) throws IOException
IOException
public void writeTextField(JRTextField textField) throws IOException
IOException
public void writeSubreport(JRSubreport subreport) throws IOException
IOException
public void writeSubreportParameter(JRSubreportParameter subreportParameter, XmlNamespace namespace) throws IOException
IOException
public 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
IOException
public void writeValueDataset(JRValueDataset dataset) throws IOException
dataset
- the value dataset to persistIOException
public void writeValueDisplay(JRValueDisplay valueDisplay) throws IOException
valueDisplay
- the description to saveIOException
public void writeItemLabel(JRItemLabel itemLabel) throws IOException
itemLabel
- the description to saveIOException
public void writeDataRange(JRDataRange dataRange) throws IOException
dataRange
- the range to writeIOException
public void writePieChart(JRChart chart) throws IOException
IOException
public void writePie3DChart(JRChart chart) throws IOException
IOException
public 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 marksIOException
public 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 marksIOException
public 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 marksIOException
public void writeBar3DPlot(JRBar3DPlot plot) throws IOException
IOException
public void writeBarChart(JRChart chart) throws IOException
IOException
public void writeBar3DChart(JRChart chart) throws IOException
IOException
public void writeBubbleChart(JRChart chart) throws IOException
IOException
public void writeStackedBarChart(JRChart chart) throws IOException
IOException
public void writeStackedBar3DChart(JRChart chart) throws IOException
IOException
public void writeLineChart(JRChart chart) throws IOException
IOException
public void writeTimeSeriesChart(JRChart chart) throws IOException
IOException
public void writeHighLowDataset(JRHighLowDataset dataset) throws IOException
IOException
public void writeHighLowChart(JRChart chart) throws IOException
IOException
public void writeGanttChart(JRChart chart) throws IOException
IOException
public void writeCandlestickChart(JRChart chart) throws IOException
IOException
public void writeAreaChart(JRChart chart) throws IOException
IOException
public void writeScatterChart(JRChart chart) throws IOException
IOException
public void writeXyAreaChart(JRChart chart) throws IOException
IOException
public void writeXyBarChart(JRChart chart) throws IOException
IOException
public void writeXyLineChart(JRChart chart) throws IOException
IOException
public void writeMeterChart(JRChart chart) throws IOException
chart
- the meter chart to writeIOException
public void writeThermometerChart(JRChart chart) throws IOException
chart
- the thermometer chart to writeIOException
public void writeMultiAxisChart(JRChart chart) throws IOException
chart
- the multiple axis chart to writeIOException
public void writeStackedAreaChart(JRChart chart) throws IOException
IOException
public void writeChartTag(JRChart chart) throws IOException
IOException
public void writeSubreportReturnValue(JRSubreportReturnValue returnValue, XmlNamespace namespace) throws IOException
IOException
protected void writeReturnValue(VariableReturnValue returnValue) throws IOException
IOException
protected void writeReturnValue(ExpressionReturnValue returnValue) throws IOException
IOException
public void writeCrosstab(JRCrosstab crosstab) throws IOException
IOException
protected void writeCrosstabRowGroup(JRCrosstabRowGroup group) throws IOException
IOException
protected void writeCrosstabColumnGroup(JRCrosstabColumnGroup group) throws IOException
IOException
protected void writeBucket(JRCrosstabBucket bucket) throws IOException
IOException
protected void writeCrosstabMeasure(JRCrosstabMeasure measure) throws IOException
IOException
protected void writeCrosstabCell(JRCrosstabCell cell) throws IOException
IOException
protected void writeCellContents(JRCellContents contents) throws IOException
IOException
protected void writeCrosstabParameter(JRCrosstabParameter parameter) throws IOException
IOException
public void writeDataset(JRDataset dataset) throws IOException
IOException
protected void writeDatasetContents(JRDataset dataset) throws IOException
IOException
public void writeDatasetRun(JRDatasetRun datasetRun) throws IOException
datasetRun
- the subdataset runIOException
public void writeFrame(JRFrame frame) throws IOException
IOException
protected void writeHyperlinkParameters(JRHyperlinkParameter[] parameters) throws IOException
IOException
protected void writeHyperlinkParameter(JRHyperlinkParameter parameter) throws IOException
IOException
public void writeHyperlink(String tagName, JRHyperlink hyperlink) throws IOException
IOException
public void writeHyperlink(String tagName, XmlNamespace namespace, JRHyperlink hyperlink) throws IOException
IOException
protected boolean toWriteConditionalStyles()
JRXmlBaseWriter
toWriteConditionalStyles
in class JRXmlBaseWriter
public JRXmlWriteHelper getXmlWriteHelper()
public Writer getUnderlyingWriter()
public void writeComponentElement(JRComponentElement componentElement) throws IOException
IOException
protected XmlNamespace getNamespace()
public void writeGenericElement(JRGenericElement element) throws IOException
IOException
public void writeMultiAxisData(MultiAxisData data) throws IOException
IOException
protected void writeDataLevelBucket(DataLevelBucket bucket) throws IOException
IOException
protected void writeExpression(String name, JRExpression expression, boolean writeClass, String defaultClassName) throws IOException
IOException
protected void writeExpression(String name, XmlNamespace namespace, JRExpression expression, boolean writeClass) throws IOException
IOException
Copyright © 2017. All rights reserved.