XML2SpreadSheet

About the Application

This is a public domain framework wrapper over popular OSS Excel generation APIs for Java. The advantage of using this framework, is that you need not learn the internals of each of these APIs.

You only need to generate the XML file, from which the Excel file will be generated using the API of choice.

Sample XML File

<workbook>
    <sheet name="wiz" col-width="" row-width="">
        <merge region="0,0,1,4"/>
        <column-width column="1" width="23"/>
        <row placement="0">
            <cell placement="0" style="align:center; text-decoration: bold; valign: center ; border: dotted">
                <text>My Heading</text>
            </cell>
        </row>
        <row placement="2">
            <cell placement="0" style="color: dark_red; background:aqua; align: center ; border : double">
                <text>Hello World!</text>
            </cell>
            <cell placement="2">
                <number>3</number>
            </cell>
            <cell placement="4">
                <date format="dd-MM-yyyy">12-12-2005</date>
            </cell>
        </row>
    </sheet>
    <!-- Sheet without name -->
    <sheet>
        <row placement="1">
            <cell placement="1">
                <text>Sheet with default name!</text>
            </cell>
        </row>
    </sheet>
</workbook>

Command-line Usage

In the command-line, give this command:

$ java -jar -Dxml2xls.impl=jxl XML2SpreadSheet-VER-jar-with-dependencies.jar jxl.xml out.xls

or

$ java -jar -Dxml2xls.impl=poi XML2SpreadSheet-VER-jar-with-dependencies.jar poi.xml out.xls

API Usage

  try{
      XML2SpreadSheet.convert(java.io.InputStream in,
              java.io.OutputStream out);
  } catch(FileNotFoundException fnfe){
      ...
  } catch(IOException ioe){
      ...
  } catch(XML2XLSFatalException e){
      ...
  }