public class JRTextExporter extends JRAbstractExporter<TextReportConfiguration,TextExporterConfiguration,WriterExporterOutput,JRTextExporterContext>
TextReportConfiguration
):
getCharWidth()
and
getCharHeight()
-
these specify how many pixels in the original report should be mapped onto a character in the exported text.getPageWidthInChars()
and
getPageHeightInChars()
-
these specify the text page width and height in characters.getPageSeparator()
exporter configuration setting. The default value is two blank lines.
The line separator to be used in the generated text file can be specified using the
getLineSeparator()
exporter configuration setting. This is most useful when you want to force a
particular line separator, knowing that the default line separator is operating system
dependent, as specified by the line.separator
system property of the JVM.
Check the supplied /demo/samples/text sample to see the kind of output this exporter
can produce.TextExporterConfiguration
,
TextReportConfiguration
Modifier and Type | Class and Description |
---|---|
protected class |
JRTextExporter.ExporterContext |
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange
Modifier and Type | Field and Description |
---|---|
protected float |
charHeight |
protected float |
charWidth |
static String |
EXCEPTION_MESSAGE_KEY_CHARACTER_HEIGHT_NEGATIVE |
static String |
EXCEPTION_MESSAGE_KEY_CHARACTER_WIDTH_NEGATIVE |
static String |
EXCEPTION_MESSAGE_KEY_REQUIRED_POSITIVE_PAGE_OR_CHARACTER_HEIGHT |
static String |
EXCEPTION_MESSAGE_KEY_REQUIRED_POSITIVE_PAGE_OR_CHARACTER_WIDTH |
protected boolean |
isTrimLineRight |
protected String |
lineSeparator |
protected int |
pageHeightInChars |
protected String |
pageSeparator |
protected int |
pageWidthInChars |
protected static String |
systemLineSeparator |
protected Writer |
writer |
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, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, parameters, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, rendererUtil, styledTextUtil, textValueClasses
Constructor and Description |
---|
JRTextExporter() |
JRTextExporter(JasperReportsContext jasperReportsContext) |
Modifier and Type | Method and Description |
---|---|
protected void |
ensureOutput() |
protected void |
exportElements(List<JRPrintElement> elements) |
protected void |
exportPage(JRPrintPage page)
Exports a page to the output writer.
|
void |
exportReport()
Performs the export.
|
protected void |
exportReportToWriter() |
protected void |
exportText(JRPrintText element)
Renders a text and places it in the output matrix.
|
protected Class<TextExporterConfiguration> |
getConfigurationInterface() |
String |
getExporterKey() |
String |
getExporterPropertiesPrefix()
Returns the properties prefix for the current exporter.
|
protected int |
getHeightInChars(int height)
Transforms height from pixel space to character space.
|
protected Class<TextReportConfiguration> |
getItemConfigurationInterface() |
protected JRStyledText |
getStyledText(JRPrintText textElement) |
protected int |
getWidthInChars(int width)
Transforms width from pixel space to character space.
|
protected void |
initExport() |
protected void |
initReport() |
createFilter, defaultParseNumber, ensureInput, ensureJasperReportsContext, getBooleanCellValue, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getCustomHandler, getDateCellValue, getDateFormat, getExporterContext, getExporterInput, getExporterOutput, getHyperlinkProducer, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getParameter, getParameters, getPropertiesUtil, getRendererUtil, getReportContext, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, insideFrame, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperPrint, setJasperReportsContext, setOffset, setOffset, setParameter, setParameters, setReportContext
public static final String EXCEPTION_MESSAGE_KEY_REQUIRED_POSITIVE_PAGE_OR_CHARACTER_WIDTH
public static final String EXCEPTION_MESSAGE_KEY_CHARACTER_WIDTH_NEGATIVE
public static final String EXCEPTION_MESSAGE_KEY_REQUIRED_POSITIVE_PAGE_OR_CHARACTER_HEIGHT
public static final String EXCEPTION_MESSAGE_KEY_CHARACTER_HEIGHT_NEGATIVE
protected Writer writer
protected int pageWidthInChars
protected int pageHeightInChars
protected float charWidth
protected float charHeight
protected String pageSeparator
protected String lineSeparator
protected boolean isTrimLineRight
protected static final String systemLineSeparator
public JRTextExporter()
JRTextExporter(JasperReportsContext)
public JRTextExporter(JasperReportsContext jasperReportsContext)
protected Class<TextExporterConfiguration> getConfigurationInterface()
protected Class<TextReportConfiguration> getItemConfigurationInterface()
protected void ensureOutput()
public void exportReport() throws JRException
Exporter
exportReport
in interface Exporter<ExporterInput,TextReportConfiguration,TextExporterConfiguration,WriterExporterOutput>
exportReport
in class JRAbstractExporter<TextReportConfiguration,TextExporterConfiguration,WriterExporterOutput,JRTextExporterContext>
JRException
protected void initExport()
protected void initReport()
protected void exportReportToWriter() throws JRException, IOException
JRException
IOException
protected void exportPage(JRPrintPage page) throws IOException
IOException
protected void exportElements(List<JRPrintElement> elements)
protected void exportText(JRPrintText element)
protected int getHeightInChars(int height)
protected int getWidthInChars(int width)
protected JRStyledText getStyledText(JRPrintText textElement)
public String getExporterKey()
public String getExporterPropertiesPrefix()
JRAbstractExporter
getExporterPropertiesPrefix
in class JRAbstractExporter<TextReportConfiguration,TextExporterConfiguration,WriterExporterOutput,JRTextExporterContext>
Copyright © 2016. All rights reserved.