Style Intelligence v12.0

inetsoft.report.io
Class DelimitedFormatter

java.lang.Object
  extended by inetsoft.report.io.BaseFormatter
      extended by inetsoft.report.io.DelimitedFormatter
All Implemented Interfaces:
Formatter

public class DelimitedFormatter
extends BaseFormatter

Converting a report to a delimited text file. Only table data is exported. All other report elements are ignored. By default cell values are separated by comma. The delimiter can be changed by calling setDelimiter(). An optional quote can be added around the values by calling setQuote().


Field Summary
protected  boolean allColumns
           
protected  String delim
           
protected  boolean keepHeader
           
protected  OutputStream output
           
protected  String quote
           
protected  ReportSheet sheet
           
protected  PrintWriter writer
           
 
Fields inherited from class inetsoft.report.io.BaseFormatter
docInfo, report
 
Constructor Summary
DelimitedFormatter(OutputStream output)
          Create a report formatter.
 
Method Summary
 void end()
          Write the end of report.
protected  void endCell()
          End a cell.
protected  void endGrid()
          End the layout grid.
 void endHeader()
          End a header section.
protected  void endRow()
          End a row.
 String getDelimiter()
          Get the cell value delimiter.
 String getQuote()
          Get the quote string.
 boolean isKeepHeader()
          Get the keepHeader value.
 void prolog(ReportSheet sheet)
          Write the prolog of report.
 void setDelimiter(String delim)
          Set the delimiter string between cell values.
 void setKeepHeader(boolean keepHeader)
          Set the keepHeader values.
 void setQuote(String quote)
          Set the quote around values.
protected  void startCell(TabularSheet sheet, int r, int c, Object bg, Insets borders, Color bcolor, Rectangle span, String width, boolean repeat)
          Start a new cell.
protected  void startGrid(int rows, int cols)
          Start a layout grid (for tabular layout).
 void startHeader(int type)
          Start a header section.
 void startHeader(String eid, boolean header)
          Start a header selection for element associated header/footer.
protected  void startRow(TabularSheet sheet, int row)
          Start a new row.
protected static String toString(Object obj)
           
 void write(AreaBreakElement elem)
          Write the area break element.
 void write(BeanElement elem)
          Write the bean element.
 void write(ChartElement elem)
          Write the chart element.
 void write(CompositeElement elem)
          Write the composite element.
 void write(CondPageBreakElement elem)
          Write the conditional page break element.
 void write(FormElement elem)
          Write the form element.
 void write(HeadingElement elem)
          Write the heading text element.
 void write(NewlineElement elem)
          Write the newline element.
 void write(PageBreakElement elem)
          Write the page break element.
 void write(PageLayoutElement elem)
          Write the page layout element.
 void write(PainterElement elem)
          Write the painter element.
 void write(SectionElement elem)
          Write the section element.
 void write(SeparatorElement elem)
          Write the separator element.
 void write(SpaceElement elem)
          Write the space element.
 void write(TabElement elem)
          Write the tab element.
 void write(TableElement elem)
          Write the table element.
 void write(TextBoxElement elem)
          Write the text box element.
 void write(TextElement elem)
          Write the text element.
 void write(TOCElement elem)
          Write the TOC element.
 void write(inetsoft.report.style.XTableStyle style)
          Write embedded table style.
protected  void writeElementContents(ReportElement elem, ReportSheet sheet)
          Export a element content object.
protected  void writeSectionBand(SectionBand band)
          Print one band.
protected  void writeShapes(PageLayout.Shape[] shapes)
          Write the pagelayout shapes specifications.
protected  void writeWarnings(ReportElement elem, ReportSheet sheet)
          Write warning messages.
 
Methods inherited from class inetsoft.report.io.BaseFormatter
addProgressListener, escape, fireProgressEvent, init, localize, removeProgressListener, setDocumentInfo, write, write, write, write, writeBeanPropertyDefinition, writeContents, writeContents, writeContents, writeSection, writeWarnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected PrintWriter writer

output

protected OutputStream output

delim

protected String delim

quote

protected String quote

keepHeader

protected boolean keepHeader

allColumns

protected boolean allColumns

sheet

protected ReportSheet sheet
Constructor Detail

DelimitedFormatter

public DelimitedFormatter(OutputStream output)
Create a report formatter.

Method Detail

startGrid

protected void startGrid(int rows,
                         int cols)
Start a layout grid (for tabular layout).

Specified by:
startGrid in class BaseFormatter
Parameters:
rows - number of rows.
cols - number of columns.

endGrid

protected void endGrid()
End the layout grid.

Specified by:
endGrid in class BaseFormatter

startRow

protected void startRow(TabularSheet sheet,
                        int row)
Start a new row.

Specified by:
startRow in class BaseFormatter
Parameters:
sheet - tabular report object.
row - row index in the grid.

endRow

protected void endRow()
End a row.

Specified by:
endRow in class BaseFormatter

startCell

protected void startCell(TabularSheet sheet,
                         int r,
                         int c,
                         Object bg,
                         Insets borders,
                         Color bcolor,
                         Rectangle span,
                         String width,
                         boolean repeat)
Start a new cell.

Specified by:
startCell in class BaseFormatter
Parameters:
r - row index.
c - column index.
bg - cell background color or image.
borders - border setting.
bcolor - border color.
span - cell span.
width - column width. See TabularSheet for width specification format.
repeat - true to repeat the cell contents on every page.

endCell

protected void endCell()
End a cell.

Specified by:
endCell in class BaseFormatter

writeShapes

protected void writeShapes(PageLayout.Shape[] shapes)
Write the pagelayout shapes specifications.

Specified by:
writeShapes in class BaseFormatter

setDelimiter

public void setDelimiter(String delim)
Set the delimiter string between cell values. It defaults to comma.

Parameters:
delim - delimiter.

getDelimiter

public String getDelimiter()
Get the cell value delimiter.

Returns:
delimiter value.

setQuote

public void setQuote(String quote)
Set the quote around values. Default is none. The quote string is added before and after each value.

Parameters:
quote - quote string.

getQuote

public String getQuote()
Get the quote string.

Returns:
quote string.

setKeepHeader

public void setKeepHeader(boolean keepHeader)
Set the keepHeader values. Default is true.

Parameters:
keepHeader - boolean.

isKeepHeader

public boolean isKeepHeader()
Get the keepHeader value.

Returns:
keepHeader value.

prolog

public void prolog(ReportSheet sheet)
Write the prolog of report.


startHeader

public void startHeader(int type)
Start a header section.

Parameters:
type - header/footer type. Defined in ReportSheet.

startHeader

public void startHeader(String eid,
                        boolean header)
Start a header selection for element associated header/footer.

Parameters:
eid - element ID.
header - true if header, false if footer.

endHeader

public void endHeader()
End a header section.


write

public void write(inetsoft.report.style.XTableStyle style)
Write embedded table style.


write

public void write(HeadingElement elem)
Write the heading text element.


write

public void write(TextElement elem)
Write the text element.


write

public void write(SectionElement elem)
           throws IOException
Write the section element.

Throws:
IOException

writeWarnings

protected void writeWarnings(ReportElement elem,
                             ReportSheet sheet)
Write warning messages.

Overrides:
writeWarnings in class BaseFormatter

write

public void write(TableElement elem)
Write the table element.


write

public void write(FormElement elem)
Write the form element.


write

public void write(PainterElement elem)
Write the painter element.


write

public void write(ChartElement elem)
Write the chart element.


write

public void write(TextBoxElement elem)
Write the text box element.


write

public void write(TabElement elem)
Write the tab element.


write

public void write(NewlineElement elem)
Write the newline element.


write

public void write(AreaBreakElement elem)
Write the area break element.


write

public void write(PageBreakElement elem)
Write the page break element.


write

public void write(PageLayoutElement elem)
Write the page layout element.


write

public void write(CondPageBreakElement elem)
Write the conditional page break element.


write

public void write(SpaceElement elem)
Write the space element.


write

public void write(SeparatorElement elem)
Write the separator element.


write

public void write(TOCElement elem)
Write the TOC element.


write

public void write(CompositeElement elem)
           throws IOException
Write the composite element.

Throws:
IOException

end

public void end()
Write the end of report.

Specified by:
end in interface Formatter
Specified by:
end in class BaseFormatter

toString

protected static String toString(Object obj)

write

public void write(BeanElement elem)
           throws IOException
Write the bean element.

Throws:
IOException

writeSectionBand

protected void writeSectionBand(SectionBand band)
                         throws IOException
Print one band.

Specified by:
writeSectionBand in class BaseFormatter
Throws:
IOException

writeElementContents

protected void writeElementContents(ReportElement elem,
                                    ReportSheet sheet)
                             throws IOException
Export a element content object.

Overrides:
writeElementContents in class BaseFormatter
Throws:
IOException

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.