Jxmlss

About jxmlss

The jxmlss toolkit is a Java-based toolkit for generating files in SpreadsheetML format (compatible with MS Excel). This toolkit was designed specifically to be packaged with a signed applet and is less than 10kb in size.

Project Goals

The jxmlss tool was designed with the following goals:

  • Capable of generating a file that can be easily read by Excel. The SpreadsheetML format was chosen because of its simplicity compared to the binary XLS format. The SpreadsheetML format can be read by MS Excel 2003 or later.
  • The library needed to be lean. There are already Java tools for reading/writing Excel and other OLE formats (See Apache POI, for example), however they are large (800kb for POI) compared to the size of this project. If you are looking for a tool as part of a J2EE project or something similar, you are likely much better off choosing something like POI. The jxmlss tool was originally intended to be downloaded with a signed applet in an evironment where download speed was a significant design issue.

Licensing

All software is licensed under the GNU Lesser General Public License.

Tutorial

The jxmlss interface is very simple to use. Basically, you create a Document object and add one or more Worksheet objects to it. Each Worksheet should have Row objects added to it. When you’re done, invoke the Document.toXMLSS() method.

A Simple Example:

 public void SimpleTest ()
  {
    Document d = new us.k5n.jxmlss.Document ();
    d.setTitle ( "Example 1" );
    d.setSubject ( "Example 1 Subject" );
    d.setDescription ( "Example 1 File For Testing" );
    d.setAuthor ( "Joe Schmoe" );
    d.setKeywords ( "Microsoft, Excel, k5n.us, Java" );
    Worksheet worksheet = new Worksheet ( "Worksheet 1" );
    Row header = new Row ();
    header.addCell ( "" ); // blank
    header.addCell ( "Value 1" );
    header.addCell ( "Value 2" );
    header.addCell ( "Value 3" );
    header.addCell ( "Property 1" );
    worksheet.addRow ( header );

    Row row = new Row ();
    row.addCell ( "Item 1" ); row.addCell ( new Float ( 0.97 ) );
    row.addCell ( new Float ( 10097 ) ); row.addCell ( new Integer ( 37 ) );
    worksheet.addRow ( row );

    row = new Row ();
    row.addCell ( "Item 2" ); row.addCell ( new Float ( 21.97 ) );
    row.addCell ( new Integer ( 447 ) );
    row.addCell ( new Float ( 432.333 ) );
    worksheet.addRow ( row );

    d.addWorksheet ( worksheet );

    String outputString = d.toXMLSS();
    // You would likely write the output to a file here...
  }

Download

Download version 1.0.0 below:

k5n-jxmlss-1.0.0.jar [4k] 
k5n-jxmlss-src-1.0.0.zip [10k] 

Developer Resources

Similar Tools