Project Wonder 5.0

er.excel
Class EGSimpleTableParser

java.lang.Object
  extended by er.excel.EGSimpleTableParser

public class EGSimpleTableParser
extends java.lang.Object

Parses an input stream for tables and converts them into excel sheets. You must have a surrounding element as there is only one root element in XML allowed.
Eg:<div><table 1><table 2>...</div> You must take care that your content is XML readable. Futhermore, there is support for a CSS-like style tagging. Either supply font and style dictionaries in the constructor or via <style> and <font> tags. The tags are shown in the example, but mainly the attributes are named the same as the properties of the HSSFCellStyle and HSSFFont objects. The symbolic names from theses classes (eg. ALIGN_RIGHT) are also supported. In addition, the tags must have an id attribute and can specify an extends attribute that contains the ID of the style that is extended - all properties from this style and it's predecessors are copied to the current style.
In addition, you can specify an attribute in any <table>, <tr>, <th> and <td> tag, when this happens a new style is created and it applies to the contents of this tag.
The value is copied as text from the cell's content, so you better take care that it is parsable and matches the cellStyle and cellFormat definition.
The parser also supports the some-name attribute names in addition to someName as using the Reformat command in WOBuilder messes up the case of the tags. When used in .wod files, the attributes must be enclosed in quotes ("cell-type"=foo;). Some care must be taken when the attributes in the current node override the ones from the parent as this is not thouroughly tested.
A client would use this class like:


 EGSimpleTableParser parser = new EGSimpleTableParser(new ByteArrayInputStream(someContentString));
 NSData result = parser.data();
 

Author:
ak

Field Summary
protected  org.apache.log4j.Logger log
          logging support
 
Constructor Summary
EGSimpleTableParser(java.io.InputStream contentStream)
           
EGSimpleTableParser(java.io.InputStream contentStream, com.webobjects.foundation.NSDictionary fontDicts, com.webobjects.foundation.NSDictionary styleDicts)
           
 
Method Summary
 com.webobjects.foundation.NSData data()
           
 org.apache.poi.hssf.usermodel.HSSFWorkbook workbook()
           
 void writeToStream(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.log4j.Logger log
logging support

Constructor Detail

EGSimpleTableParser

public EGSimpleTableParser(java.io.InputStream contentStream)

EGSimpleTableParser

public EGSimpleTableParser(java.io.InputStream contentStream,
                           com.webobjects.foundation.NSDictionary fontDicts,
                           com.webobjects.foundation.NSDictionary styleDicts)
Method Detail

writeToStream

public void writeToStream(java.io.OutputStream out)
                   throws java.io.IOException
Throws:
java.io.IOException

data

public com.webobjects.foundation.NSData data()

workbook

public org.apache.poi.hssf.usermodel.HSSFWorkbook workbook()

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.