Content

Introduction
Direct positioning for cells
Positioning with autoincrement
Styles
Color
Border
Image
Charts

Introduction

The Spreadsheet::XML_to_XLS module gives nothing except another way to use Spreadsheet::WriteExcel, written by John McNamara (jmcnamara@cpan.org). But in conjuntion with XLST technology it allows to build user-friendly Excel document with data, which were taken from any external source.

For example, let's build new Excel report to represent information from the "downloads" table in some Oracle database. It takes just 3 trivial steps now.

Step 1. Extract data from some source (Oracle DB)
Let's export data from Oracle DB.
First create the following oracle.sql file:
set heading off
set feedback off
set pagesize 0
set linesize 0
set long 999999
spool oracle.xml
select dbms_xmlgen.getxml (
    'select * from downloads order by amount desc'
) xml from dual;
spool off
quit
Then use the SQL file to get data and save in the oracle.xml file:
$ sqlplus
<enter log name, password, and SID to pass authentication in Oracle>
> @oracle.sql
Let's assume, we got the following XML document in the oracle.xml file:

<ROWSET>
 <ROW>
  <COUNTRY>U.S.</COUNTRY>
  <AMOUNT>509</AMOUNT>
 </ROW>
 <ROW>
  <COUNTRY>China</COUNTRY>
  <AMOUNT>99</AMOUNT>
 </ROW>
 <ROW>
  <COUNTRY>U.K.</COUNTRY>
  <AMOUNT>81</AMOUNT>
 </ROW>
 <ROW>
  <COUNTRY>Canada</COUNTRY>
  <AMOUNT>41</AMOUNT>
 </ROW>
 <ROW>
  <COUNTRY>Germany</COUNTRY>
  <AMOUNT>40</AMOUNT>
 </ROW>
 <ROW>
  <COUNTRY>France</COUNTRY>
  <AMOUNT>40</AMOUNT>
 </ROW>
</ROWSET>
Step 2. Modify XML document.
Now you have to modify the oracle.xml document to meet requirements of the Spreadsheet::XML_to_XLS module.
First create the following modify.xsl file:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent='yes' doctype-system='xml_to_excel.dtd'/>
    <xsl:template match="/">
        <workbook>
            <xsl:for-each select="ROWSET">
                <worksheet>
                    <set bold="1">
                        <cell>Country</cell>
                        <cell width="12">Downloads</cell>
                    </set>
                    <set type="col">
                       <xsl:for-each select="ROW">
                           <set>
                               <cell><xsl:value-of select="COUNTRY"/></cell>
                               <cell><xsl:value-of select="AMOUNT"/></cell>
                           </set>
                       </xsl:for-each>
                       <set col="+0" name="country"/>
                       <set col="+1" name="amount"/>
                    </set>
                    <chart pos="C2" type="column" x="15" y="5">
                        <data category="country" values="amount"/>
                        <title name="Downloads (millions)"/>
                    </chart>
                </worksheet>
            </xsl:for-each>
        </workbook>
    </xsl:template>
</xsl:stylesheet>
Then take document from oracle.xml, modify it by means modify.xsl, and save result in excel.xml:
$ java -cp xalan-j_2_7_0/xalan.jar org.apache.xalan.xslt.Process -in oracle.xml -xsl modify.xsl -out excel.xml
You have to receive the following excel.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workbook SYSTEM "xml_to_excel.dtd">
<workbook>
<worksheet>
<set bold="1">
<cell>Country</cell>
<cell width="12">Downloads</cell>
</set>
<set type="col">
<set>
<cell>U.S.</cell>
<cell>509</cell>
</set>
<set>
<cell>China</cell>
<cell>99</cell>
</set>
<set>
<cell>U.K.</cell>
<cell>81</cell>
</set>
<set>
<cell>Canada</cell>
<cell>41</cell>
</set>
<set>
<cell>Germany</cell>
<cell>40</cell>
</set>
<set>
<cell>France</cell>
<cell>40</cell>
</set>
<set name="country" col="+0"/>
<set name="amount" col="+1"/>
</set>
<chart y="5" x="15" type="column" pos="C2">
<data values="amount" categories="country"/>
<title name="Downloads (millions)"/>
</chart>
</worksheet>
</workbook>
Step 3. Build an Excel document.
Build final excel.xls document by means the Spreadsheet::XML_to_XLS module:
$ export PERLLIB=/usr/lib/perl/5.10
$ perl -e 'use Spreadsheet::XML_to_XLS; Spreadsheet::XML_to_XLS->build("excel.xml", "excel.xls");'
We have to receive the following document in the excel.xls file:

So, you don't need to be an Oracle expert to build such report. Neither an Java guru. Neither a Perl adept.
You don't need to be familiar with programming at all.
Also pay attention, you don't need Microsoft Windows to build that Excel report. For example, I wrote shell scripts to deliver such reports from Unix server.

Now we are ready to start with main guide.
No any coding forever, just deal with data in input text file.

Direct positioning for each cell

Example 1. Row and column numbers

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets">
        <cell row='0' col='1'>AAA</cell>
        <cell row='1' col='0'>BBB</cell>
        <cell row='1' col='2'>CCC</cell>
        <cell row='2' col='1'>DDD</cell>
    </worksheet>
</workbook>
Keep in mind, unlike Excel, the package indexes columns and rows from zero, but not from one.

Example 2. Alphanumerical position

The package allows to use positioning in Excel style.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets">
        <cell pos='B1'>AAA</cell>
        <cell pos='A2'>BBB</cell>
        <cell pos='C2'>CCC</cell>
        <cell pos='B3'>DDD</cell>
    </worksheet>
</workbook>
The same result as for Example 1.

Positioning with autoincrementing

Example 3. All cells in one column

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets">
        <cell>AAAA</cell>
        <cell>BBBB</cell>
        <cell>CCCC</cell>
        <cell>DDDD</cell>
    </worksheet>
</workbook>

Example 4. All cells in one row

You may use the "type" attribute to change layout. The attribute has to have the "col" or "row" value.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" type="row">
        <cell>AAAA</cell>
        <cell>BBBB</cell>
        <cell>CCCC</cell>
        <cell>DDDD</cell>
    </worksheet>
</workbook>

Example 5. Jump to another position

You may change position for next cell manualy, but not follow autoincrement
In that example the "CCCC" cell been shifted to column No 3 (the "D" column).
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" type="row">
        <cell>AAAA</cell>
        <cell>BBBB</cell>
        <cell col="3">CCCC</cell>
        <cell>DDDD</cell>
    </worksheet>
</workbook>

Example 6. Change start position for a column or row

You may specify position for new row or column in the worksheet tag.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" col="1" row="1">
        <cell>AAAA</cell>
        <cell>BBBB</cell>
        <cell>CCCC</cell>
        <cell>DDDD</cell>
    </worksheet>
</workbook>
or
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" pos="B2">
        <cell>AAAA</cell>
        <cell>BBBB</cell>
        <cell>CCCC</cell>
        <cell>DDDD</cell>
    </worksheet>
</workbook>
the same result

Example 7. Multiple rows

You may use several set tags to create few rows or columns.
Sets may be nested. They may use the same attributes as worksheet
(I used the bg_color attribute to highlight columns.)
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets">
        <set bg_color="#FFFFC0">
            <cell>AAAA</cell>
            <cell>BBBB</cell>
            <cell>CCCC</cell>
            <cell>DDDD</cell>
            <cell>EEEE</cell>
        </set>
        <set bg_color="#FFC0FF">
            <cell>aaaa</cell>
            <cell>bbbb</cell>
            <cell>cccc</cell>
        </set>
        <set bg_color="#C0FFFF">
            <cell>1111</cell>
            <cell>2222</cell>
            <cell>3333</cell>
            <cell>4444</cell>
        </set>
    </worksheet>
</workbook>

Example 8. Multiple cols

You may specify the type="row" attribute in the worksheet tag to build columns, but not rows:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" type="row">
        <set bg_color="#FFFFC0">
            <cell>AAAA</cell>
            <cell>BBBB</cell>
            <cell>CCCC</cell>
            <cell>DDDD</cell>
            <cell>EEEE</cell>
        </set>
        <set bg_color="#FFC0FF">
            <cell>aaaa</cell>
            <cell>bbbb</cell>
            <cell>cccc</cell>
        </set>
        <set bg_color="#C0FFFF">
            <cell>1111</cell>
            <cell>2222</cell>
            <cell>3333</cell>
            <cell>4444</cell>
        </set>
    </worksheet>
</workbook>

Example 9. Skip columns and rows

You may use "+n" value to skip n columns or rows.
Skip 2 rows before the "EEEE" cell
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets">
        <cell>AAAA</cell>
        <cell>BBBB</cell>
        <cell>CCCC</cell>
        <cell>DDDD</cell>
        <cell row="+2">EEEE</cell>
        <cell>FFFF</cell>
        <cell>GGGG</cell>
    </worksheet>
</workbook>
Skip 1 column before 2nd and 3rd set.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" type="row" font="Arial" size="8">
        <set>
            <cell>1 * 1 = 1</cell>
            <cell>1 * 2 = 2</cell>
            <cell>1 * 3 = 3</cell>
            <cell>1 * 4 = 4</cell>
            <cell>1 * 5 = 5</cell>
            <cell>1 * 6 = 6</cell>
            <cell>1 * 7 = 7</cell>
            <cell>1 * 8 = 8</cell>
            <cell>1 * 9 = 9</cell>
            <cell>1 * 10 = 10</cell>
        </set>
        <set col="+1">
            <cell>2 * 1 = 2</cell>
            <cell>2 * 2 = 4</cell>
            <cell>2 * 3 = 6</cell>
            <cell>2 * 4 = 8</cell>
            <cell>2 * 5 = 10</cell>
            <cell>2 * 6 = 12</cell>
            <cell>2 * 7 = 14</cell>
            <cell>2 * 8 = 16</cell>
            <cell>2 * 9 = 18</cell>
            <cell>2 * 10 = 20</cell>
        </set>
        <set col="+1">
            <cell>3 * 1 = 3</cell>
            <cell>3 * 2 = 6</cell>
            <cell>3 * 3 = 9</cell>
            <cell>3 * 4 = 12</cell>
            <cell>3 * 5 = 15</cell>
            <cell>3 * 6 = 18</cell>
            <cell>3 * 7 = 21</cell>
            <cell>3 * 8 = 24</cell>
            <cell>3 * 9 = 27</cell>
            <cell>3 * 10 = 30</cell>
        </set>
    </worksheet>
</workbook>

Styles

Example 10. Properties with boolean selector

There are few formats been allowed to turn on or turn off certain property.
Look at possible sintaxes for the bold property for
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" size="8" pos="B2">
        <set>
            <cell bold="0">bold="0"</cell>
            <cell bold="1">bold="1"</cell>
            <cell italic="1">numeric switch</cell>
        </set>
        <set>
            <cell bold="no">bold="no"</cell>
            <cell bold="yes">bold="yes"</cell>
            <cell italic="1">user-friendly no/yes switch</cell>
        </set>
        <set>
            <cell bold="No">bold="No"</cell>
            <cell bold="Yes">bold="Yes"</cell>
            <cell italic="1">the switch is case-insensitive</cell>
        </set>
        <set>
            <cell bold="n">bold="n"</cell>
            <cell bold="y">bold="y"</cell>
            <cell italic="1">the no/yes switch been reduced to one character</cell>
        </set>
        <set>
            <cell bold="off">bold="off"</cell>
            <cell bold="on">bold="on"</cell>
            <cell italic="1">off/on switch</cell>
        </set>
        <set>
            <cell bold="false">bold="false"</cell>
            <cell bold="true">bold="true"</cell>
            <cell italic="1">boolean format</cell>
        </set>
    </worksheet>
</workbook>
The same way you may assign italic and underline attributes.

Example 11. Inherit style

Let's take hte following input XML document:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets">
        <set>
            <cell font="Arial" size="8" italic="1" bold="1">Day</cell>
            <cell font="Arial" size="8" italic="1" bold="1">Hours</cell>
        </set>
        <set>
            <cell font="Arial" size="8">Monday</cell>
            <cell font="Arial" size="8">8.2</cell>
        </set>
        <set>
            <cell font="Arial" size="8">Tuesday</cell>
            <cell font="Arial" size="8">12.7</cell>
        </set>
        <set>
            <cell font="Arial" size="8">Wednesday</cell>
            <cell font="Arial" size="8">11.5</cell>
        </set>
        <set>
            <cell font="Arial" size="8">Thursday</cell>
            <cell font="Arial" size="8">7.4</cell>
        </set>
        <set>
            <cell font="Arial" size="8">Friday</cell>
            <cell font="Arial" size="8">5.1</cell>
        </set>
        <set>
            <cell font="Arial" size="8" italic="1" bold="1">Total</cell>
            <cell font="Arial" size="8" italic="1" bold="1"><![CDATA[=SUM(B2:B6)]]></cell>
        </set>
    </worksheet>
</workbook>
All cells in a set have the same list of attributes.
And we may move these attributes from set to appropriate set tag.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets">
        <set font="Arial" size="8" italic="1" bold="1">
            <cell>Day</cell>
            <cell>Hours</cell>
        </set>
        <set font="Arial" size="8">
            <cell>Monday</cell>
            <cell>8.2</cell>
        </set>
        <set font="Arial" size="8">
            <cell>Tuesday</cell>
            <cell>12.7</cell>
        </set>
        <set font="Arial" size="8">
            <cell>Wednesday</cell>
            <cell>11.5</cell>
        </set>
        <set font="Arial" size="8">
            <cell>Thursday</cell>
            <cell>7.4</cell>
        </set>
        <set font="Arial" size="8">
            <cell>Friday</cell>
            <cell>5.1</cell>
        </set>
        <set font="Arial" size="8" italic="1" bold="1">
            <cell>Total</cell>
            <cell><![CDATA[=SUM(B2:B6)]]></cell>
        </set>
    </worksheet>
</workbook>
The same result.
Now we may see, all these set tags have 2 similar attributes: font="Arial" size="8".
Let's shift them 1 step up to the worksheet tag:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" font="Arial" size="8">
        <set italic="1" bold="1">
            <cell>Day</cell>
            <cell>Hours</cell>
        </set>
        <set>
            <cell>Monday</cell>
            <cell>8.2</cell>
        </set>
        <set>
            <cell>Tuesday</cell>
            <cell>12.7</cell>
        </set>
        <set>
            <cell>Wednesday</cell>
            <cell>11.5</cell>
        </set>
        <set>
            <cell>Thursday</cell>
            <cell>7.4</cell>
        </set>
        <set>
            <cell>Friday</cell>
            <cell>5.1</cell>
        </set>
        <set italic="1" bold="1">
            <cell>Total</cell>
            <cell><![CDATA[=SUM(B2:B6)]]></cell>
        </set>
    </worksheet>
</workbook>
Still the same result.
In other words, these font="Arial" size="8" attributes define common style for all cells in the Markets worksheet.
You may declare new style with name="default".
The style will be applied for all cell in all worksheets by default.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <style name="default" font="Arial" size="8"/>
    <worksheet name="Markets">
        <set italic="1" bold="1">
            <cell>Day</cell>
            <cell>Hours</cell>
        </set>
        <set>
            <cell>Monday</cell>
            <cell>8.2</cell>
        </set>
        <set>
            <cell>Tuesday</cell>
            <cell>12.7</cell>
        </set>
        <set>
            <cell>Wednesday</cell>
            <cell>11.5</cell>
        </set>
        <set>
            <cell>Thursday</cell>
            <cell>7.4</cell>
        </set>
        <set>
            <cell>Friday</cell>
            <cell>5.1</cell>
        </set>
        <set italic="1" bold="1">
            <cell>Total</cell>
            <cell><![CDATA[=SUM(B2:B6)]]></cell>
        </set>
    </worksheet>
</workbook>
The same result.
The first a the last sets have little different style: font="Arial" size="8" italic="1" bold="1".
Let's describe that style as second style and name it header:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <style name="default" font="Arial" size="8"/>
    <style name="header" font="Arial" size="8" italic="1" bold="1"/>
    <worksheet name="Markets">
        <set style="header">
            <cell>Day</cell>
            <cell>Hours</cell>
        </set>
        <set>
            <cell>Monday</cell>
            <cell>8.2</cell>
        </set>
        <set>
            <cell>Tuesday</cell>
            <cell>12.7</cell>
        </set>
        <set>
            <cell>Wednesday</cell>
            <cell>11.5</cell>
        </set>
        <set>
            <cell>Thursday</cell>
            <cell>7.4</cell>
        </set>
        <set>
            <cell>Friday</cell>
            <cell>5.1</cell>
        </set>
        <set style="header">
            <cell>Total</cell>
            <cell><![CDATA[=SUM(B2:B6)]]></cell>
        </set>
    </worksheet>
</workbook>
The same result.
A style may inherit (extend) other style.
For example, the header style may extend the default style, but not describe font and size attributes itself:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <style name="default" font="Arial" size="8"/>
    <style name="header" extend="default" italic="1" bold="1"/>
    <worksheet name="Markets">
        <set style="header">
            <cell>Day</cell>
            <cell>Hours</cell>
        </set>
        <set>
            <cell>Monday</cell>
            <cell>8.2</cell>
        </set>
        <set>
            <cell>Tuesday</cell>
            <cell>12.7</cell>
        </set>
        <set>
            <cell>Wednesday</cell>
            <cell>11.5</cell>
        </set>
        <set>
            <cell>Thursday</cell>
            <cell>7.4</cell>
        </set>
        <set>
            <cell>Friday</cell>
            <cell>5.1</cell>
        </set>
        <set style="header">
            <cell>Total</cell>
            <cell><![CDATA[=SUM(B2:B6)]]></cell>
        </set>
    </worksheet>
</workbook>
The same result.
You may create multi-level hierarhy of styles.

Example 12. Color

There are few predefined colors in the Spreadsheet::WriteExcel module.
But I can use few other colors, which I select yourself.
User-defined color has to have the following format: #[0-9A-F]{6}.
There are 3 color-related attributes: color, bg_color, fg_color.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet name="Markets" pos="B2">
        <cell bg_color="black" color="white">black</cell>
        <cell bg_color="white">white</cell>
        <cell bg_color="red">red</cell>
        <cell bg_color="lime">lime</cell>
        <cell bg_color="blue" color="yellow">blue</cell>
        <cell bg_color="yellow">yellow</cell>
        <cell bg_color="magenta">magenta</cell>
        <cell bg_color="cyan">cyan</cell>
        <cell bg_color="brown" color="white">brown</cell>
        <cell bg_color="green" color="white">green</cell>
        <cell bg_color="navy" color="white">navy</cell>
        <cell bg_color="purple" color="white">purple</cell>
        <cell bg_color="silver">silver</cell>
        <cell bg_color="gray">gray</cell>
        <cell bg_color="orange">orange</cell>
        <set>
            <cell bg_color="#C08040" color="white">#C08040</cell>
            <cell italic="yes">	user-defined color</cell>
        </set>
    </worksheet>
</workbook>
There is simple example of using colors below.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <style name="default" font="Arial" size="8" bg_color="#E0E0E0"/>
    <style name="header" extend="default" italic="1" bold="1" bg_color="silver"/>
    <worksheet name="Markets" pos="B3">
        <set style="header">
            <cell>Day</cell>
            <cell>Hours</cell>
        </set>
        <set>
            <cell>Monday</cell>
            <cell>8.2</cell>
        </set>
        <set>
            <cell>Tuesday</cell>
            <cell>12.7</cell>
        </set>
        <set>
            <cell>Wednesday</cell>
            <cell>11.5</cell>
        </set>
        <set>
            <cell>Thursday</cell>
            <cell>7.4</cell>
        </set>
        <set>
            <cell>Friday</cell>
            <cell>5.1</cell>
        </set>
        <set style="header">
            <cell>Total</cell>
            <cell><![CDATA[=SUM(C4:C8)]]></cell>
        </set>
    </worksheet>
</workbook>

Example 13. Filling skipped cells

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set name="track" row="1" bg_color="yellow">
            <cell>step</cell>
            <cell>step</cell>
            <cell col="+1">jump</cell>
            <cell>step</cell>
            <cell>step</cell>
        </set>
        <set name="sandbox" bg_color="silver">
            <cell row='3' col='2'>AAA</cell>
            <cell row='4' col='1'>BBB</cell>
            <cell row='4' col='3'>CCC</cell>
            <cell row='5' col='2'>DDD</cell>
        </set>
    </worksheet>
</workbook>
We pass the C2 cell in the trank set. But the cell should be filled with yesllow color nervertheless.
In the sandbox set we describe 4 cells only. But all 9 cells have to get silver background color.

Example 14. Width and height for cells

Sometimes cells are too small to show content.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="c2" type="row">
            <cell>In a galaxy far, far away.</cell>
            <cell> </cell>
            <cell pos="b3">There are
many lines 
of text.</cell>
    </worksheet>
</workbook>
You may specify expected width and height for cells yourself:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="c2" type="row">
            <cell width="20">In a galaxy far, far away.</cell>
            <cell> </cell>
            <cell pos="b3" height="36">There are
many lines 
of text.</cell>
    </worksheet>
</workbook>
You may specify width and height for a set of cells. For example,
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="C3">
        <set name="track" bg_color="yellow" width="4.2">
            <cell>step</cell>
            <cell>step</cell>
            <cell col="+1">jump</cell>
            <cell>step</cell>
            <cell>step</cell>
        </set>
    </worksheet>
</workbook>
Columns from C to H have reduced width now. Pay attention, other columns still have standard width.

Example 15. Align

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet width="15">
        <set pos="C2" type="row" bold="yes">
            <cell align="right">align="right"</cell>
            <cell align="center">align="center"</cell>
            <cell align="left">align="left"</cell>
        </set>
        <set pos="B3" type="col" bold="yes">
            <cell valign="bottom">valign="bottom"</cell>
            <cell valign="vcenter">valign="vcenter"</cell>
            <cell valign="top">valign="top"</cell>
        </set>
        <set pos="C3" type="col" height="30">
            <set>
                <cell align="right" valign="bottom">AAAA</cell>
                <cell align="center" valign="bottom">BBBB</cell>
                <cell align="left" valign="bottom">CCCC</cell>
            </set>
            <set>
                <cell align="right" valign="vcenter">DDDD</cell>
                <cell align="center" valign="vcenter">EEEE</cell>
                <cell align="left" valign="vcenter">FFFF</cell>
            </set>
            <set>
                <cell align="right" valign="top">GGGG</cell>
                <cell align="center" valign="top">HHHH</cell>
                <cell align="left" valign="top">IIII</cell>
            </set>
        </set>
    </worksheet>
</workbook>
Note: The valign="middle" attribute is also acceptable here to meet HTML standard.
It has the same effect as valign="vcenter" above.

Example 16. Wrapping and indent

You may specify indent for text in any cell.
Also you may execute wrapping to show long text withing single cell.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2" width="25">
        <cell>no indent</cell>
        <cell indent="1">indent="1"</cell>
        <cell indent="2">indent="2"</cell>
        <cell indent="3">indent="3"</cell>
        <cell wrap="yes" height="47">The Sinai Agama is an agamid lizard native to northern and eastern Africa and the Middle East.</cell>
    </worksheet>
</workbook>

Example 17. Comment

The comment attribute is allowed in the cell tag only.
You may use the comment attribute to make short comment for a cell.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2">
        <cell comment="This is a comment">Hello</cell>
    </worksheet>
</workbook>
You may use the comment tag to make long comment for a cell.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <cell>Bellevue<comment>Bellevue is a city in the Eastside region of King County, Washington, United States, across Lake Washington from Seattle. 
Long known as a suburb or satellite city of Seattle, it is now categorized as an edge city or a boomburb with a population of 122,363 at the 2010 census.</comment></cell>
    </worksheet>
</workbook>

Example 18. Truncate text and comment

You can use the trunc attribute to truncate text in some cell or comment.
The trunc attibure cuts spaces at the beginning and end of the text. Also it replaces all ends of line inside the text with space character.
For example,
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <cell trunc="yes">
Bellevue
<comment trunc="yes">
Bellevue is a city in the Eastside region of King County, 
Washington, United States, across Lake Washington from Seattle. 
Long known as a suburb or satellite city of Seattle, 
it is now categorized as an edge city or a boomburb with 
a population of 122,363 at the 2010 census.
</comment>
        </cell>
    </worksheet>
</workbook>
You can see, that input XML document is more readable, than previous one.

Example 19. Size of dropdown window for comment

You can specify size of the window in pixels by means width and height attributes.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <cell trunc="yes">
Bellevue
<comment trunc="yes" width="150" height="160">
Bellevue is a city in the Eastside region of King County, 
Washington, United States, across Lake Washington from Seattle. 
Long known as a suburb or satellite city of Seattle, 
it is now categorized as an edge city or a boomburb with 
a population of 122,363 at the 2010 census.
</comment>
        </cell>
    </worksheet>
</workbook>

Example 20. Border

The border and border_color allow to describe border for a cell.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <style name="data" color="#606060" height="20" align="center" valign="middle"/>
    <worksheet pos="B2">
        <cell border="1" border_color="red" align="center">Hello</cell>
        <set row="+2" style="data" width="1">
            <set width="12">
                <cell border="1">border="1"</cell>
                <cell border="2" row="+1">border="2"</cell>
                <cell border="3" row="+1">border="3"</cell>
                <cell border="4" row="+1">border="4"</cell>
                <cell border="5" row="+1">border="5"</cell>
            </set>
            <set col="+1" width="12">
                <cell border="6">border="6"</cell>
                <cell border="7" row="+1">border="7"</cell>
                <cell border="8" row="+1">border="8"</cell>
                <cell border="9" row="+1">border="9"</cell>
                <cell border="10" row="+1">border="10"</cell>
            </set>
            <set col="+1" width="12">
                <cell border="11">border="11"</cell>
                <cell border="12" row="+1">border="12"</cell>
                <cell border="13" row="+1">border="13"</cell>
            </set>
        </set>
    </worksheet>
</workbook>
Note: There are few other boder-related implicit attributes:
border_top, border_bottom, border_left, border_right,
border_top_color, border_bottom_color, border_left_color, border_right_color.
You are not expected to use them ever yourself.

You may create internal grid for any set of cells by means these 2 attributes.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set name="sandbox" align="center" bg_color="silver" border="1" border_color="gray">
            <cell row='1' col='2'>AAA</cell>
            <cell row='2' col='1'>BBB</cell>
            <cell row='2' col='3'>CCC</cell>
            <cell row='3' col='2'>DDD</cell>
        </set>
    </worksheet>
</workbook>
You may use the border_common and border_common_color attributes the same way to build common frame for a set of cells.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set name="sandbox" align="center" bg_color="silver" border="1" border_color="gray" 
             border_common="6" border_common_color="blue">
            <cell row='1' col='2'>AAA</cell>
            <cell row='2' col='1'>BBB</cell>
            <cell row='2' col='3'>CCC</cell>
            <cell row='3' col='2'>DDD</cell>
        </set>
    </worksheet>
</workbook>
Another example without internal grid:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set name="sandbox" align="center" bg_color="silver" border_color="gray" border_common="2">
            <cell row='1' col='2'>AAA</cell>
            <cell row='2' col='1'>BBB</cell>
            <cell row='2' col='3'>CCC</cell>
            <cell row='3' col='2'>DDD</cell>
        </set>
    </worksheet>
</workbook>

Example 21. Join cells

The colspan attribute allows to join two or more cells in the same row.
The package doesn't allow to join cells in the same column.
There is centering for content of the joined cell.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="A2" type="row">
        <cell align="right">###</cell>
        <cell colspan="2">Hello, world!</cell>
        <cell align="left">###</cell>
    </worksheet>
</workbook>

Example 22. Image

Image in a cell.
The src is mandatory attribute, which specify an image to be inserted.
Optional x and y attributes execute tiny positioning for the image withing cell (left upper corner).
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2" align="right">
        <set bold="yes" align="center">
            <cell width="12">Indices</cell>
            <cell>Price</cell>
            <cell width="3"> </cell>
            <cell colspan="2">Today's Change</cell>
        </set>
        <set>
            <cell>FTSE 100</cell>
            <cell>5,649.68</cell>
            <cell><img src="up.png" x="6" y="1"/></cell>
            <cell>+25.42</cell>
            <cell>+0.45%</cell>
        </set>
        <set>
            <cell>DAX</cell>
            <cell>6,057.92</cell>
            <cell><img src="down.png" x="6" y="2"/></cell>
            <cell>-38.07</cell>
            <cell>-0.62%</cell>
        </set>
        <set>
            <cell>CAC 40</cell>
            <cell>3,137.36</cell>
            <cell><img src="down.png" x="6" y="2"/></cell>
            <cell>-7.55</cell>
            <cell>-0.24%</cell>
        </set>
        <set>
            <cell>TR EUROPE</cell>
            <cell>118.66</cell>
            <cell><img src="down.png" x="6" y="2"/></cell>
            <cell>-0.92</cell>
            <cell>-0.77%</cell>
        </set>
    </worksheet>
</workbook>
You may combine text and images withing single cell also.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2" align="right">
        <set bold="yes" align="center">
            <cell width="12">Indices</cell>
            <cell>Price</cell>
            <cell colspan="2">Today's Change</cell>
        </set>
        <set>
            <cell>FTSE 100</cell>
            <cell>5,649.68</cell>
            <cell><img src="up.png" x="6" y="1"/>+25.42</cell>
            <cell>+0.45%</cell>
        </set>
        <set>
            <cell>DAX</cell>
            <cell>6,057.92</cell>
            <cell><img src="down.png" x="6" y="2"/>-38.07</cell>
            <cell>-0.62%</cell>
        </set>
        <set>
            <cell>CAC 40</cell>
            <cell>3,137.36</cell>
            <cell><img src="down.png" x="6" y="2"/>-7.55</cell>
            <cell>-0.24%</cell>
        </set>
        <set>
            <cell>TR EUROPE</cell>
            <cell>118.66</cell>
            <cell><img src="down.png" x="6" y="2"/>-0.92</cell>
            <cell>-0.77%</cell>
        </set>
    </worksheet>
</workbook>

Image in a worksheet.
You have to specify desired position for the image in that case. (The pos attirbute or the col&row ones)
The src attribute specify path and file name for picture to be inserted.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2" align="right">
        <set>
            <cell colspan="2" bold="yes" trunc="yes">
                 Intel Corp (INTC.O)
            </cell>
        </set>
        <img pos="B7" src="intel.png"/>
        <set row="+1" width="10">
            <set width="17">
                <cell bold="yes">INTC.O on Nasdaq</cell>
                <cell>25.25 USD</cell>
                <cell>6 Jan 2012</cell>
            </set>
            <set width="20">
                <cell bold="yes">Price change (% chg)</cell>
                <cell>$-0.15 (-0.59%)</cell>
            </set>
            <set col="+1">
                <cell bold="yes">Prev Close</cell>
                <cell>$25.40</cell>
            </set>
            <set>
                <cell bold="yes">Open</cell>
                <cell>$25.21</cell>
            </set>
            <set>
                <cell bold="yes">Volume</cell>
                <cell>36,345,172</cell>
                <cell bold="yes" row="+1">Avg. Vol</cell>
                <cell>33,578,436</cell>
                <cell bold="yes" row="+1">52-wk High</cell>
                <cell>$25.78</cell>
                <cell bold="yes" row="+1">52-wk Low</cell>
                <cell>$19.16</cell>
            </set>
        </set>
    </worksheet>
</workbook>

Charts

Current package supports few predefined types of charts.

Example 23. Area

You may build some simple charts while transfering from XML to Excel.
For the chart tag you have to specify position. (pos or col&row))
Also you have to specify data for the chart in the values attribute.
The type="area" deternime type of the chart.
You may use x and y to make tiny positioning for the chart.
And you may specify size of the chart by means the width and height attributes.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <cell>1</cell>
        <cell>4</cell>
        <cell>5</cell>
        <cell>2</cell>
        <cell>1</cell>
        <cell>5</cell>
        <chart pos="B2" type="area" x="10" width="0.7" height="0.7">
             <data values="$A$1:$A$6"/>
        </chart>
    </worksheet>
</workbook>
It may be annoying to deal with Excel annotation for value in the values attribute. (values="$A$1:$A$6" in the example)
The package proposes much easier decision.
Just put these data cells into some named set. Then tell name of the set in the values attribute.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet type="row">
        <set name="dataset">
            <cell>1</cell>
            <cell>4</cell>
            <cell>5</cell>
            <cell>2</cell>
            <cell>1</cell>
            <cell>5</cell>
        </set>
        <chart pos="B2" type="area" x="10" width="0.7" height="0.7">
            <data values="dataset"/>
        </chart>
    </worksheet>
</workbook>
The same result.
There may be a row of cells with data, but not a column.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set name="dataset">
            <cell>1</cell>
            <cell>4</cell>
            <cell>5</cell>
            <cell>2</cell>
            <cell>1</cell>
            <cell>5</cell>
        </set>
        <chart pos="A2" type="area" x="10" y="10" width="0.7" height="0.7">
            <data values="dataset"/>
        </chart>
    </worksheet>
</workbook>

Example 24. A virtual set

We have few rows with some information. And we want to build a chart with data from the C3:C8 column.
Unfortunately, cells for that columns are included in blue rows already.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2">
        <set>
            <cell bold="yes" trunc="yes">
                 Holiday week downloads (millions)
            </cell>
        </set>
        <set border="1" border_color="silver" bg_color="#E0E0FF">
            <cell>U.S.</cell>
            <cell>509</cell>
        </set>
        <set border="1" border_color="silver" bg_color="#C0C0FF">
            <cell>China</cell>
            <cell>99</cell>
        </set>
        <set border="1" border_color="silver" bg_color="#E0E0FF">
            <cell>U.K.</cell>
            <cell>81</cell>
        </set>
        <set border="1" border_color="silver" bg_color="#C0C0FF">
            <cell>Canada</cell>
            <cell>41</cell>
        </set>
        <set border="1" border_color="silver" bg_color="#E0E0FF">
            <cell>Germany</cell>
            <cell>40</cell>
        </set>
        <set border="1" border_color="silver" bg_color="#C0C0FF">
            <cell>France</cell>
            <cell>40</cell>
        </set>
    </worksheet>
</workbook>
Decision is
- Insert wrapping set to group data cells. (<set type="...">...</set>). Pay attention, the set does not include the "Holiday week..." header.
- Withing the wrapping set insert empty set, which has name and col attributes (<set name="..." col="2"/>).
- You may use the name ("dataset") to deliver that column to a chart.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2" name="Market">
        <set>
            <cell bold="yes" trunc="yes">
                Holiday week downloads (millions)
            </cell>
        </set>
        <set type="col">
            <set border="1" border_color="silver" bg_color="#E0E0FF" name="US data">
                <cell>U.S.</cell>
                <cell>509</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#C0C0FF">
                <cell>China</cell>
                <cell>99</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#E0E0FF">
                <cell>U.K.</cell>
                <cell>81</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#C0C0FF">
                <cell>Canada</cell>
                <cell>41</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#E0E0FF">
                <cell>Germany</cell>
                <cell>40</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#C0C0FF">
                <cell>France</cell>
                <cell>40</cell>
            </set>
            <set name="dataset" col="2"/>
        </set>
        <chart pos="D3" type="area" x="10" y="10" width="0.7" height="0.7">
            <data values="dataset"/>
        </chart>
    </worksheet>
</workbook>
Pay attention, we used the col="2" attribute for that virtual set. It means column C.
It would be easier to use relative positioning in the col attribute, but not specify column number.
col="+0" takes the first column from the wrapping set.
col="+1" takes the second column.
col="+2" takes the third column, etc.
In current example we take data cells from the second column:
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2" name="Market">
        <set>
            <cell bold="yes" trunc="yes">
                Holiday week downloads (millions)
            </cell>
        </set>
        <set type="col">
            <set border="1" border_color="silver" bg_color="#E0E0FF" name="US data">
                <cell>U.S.</cell>
                <cell>509</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#C0C0FF">
                <cell>China</cell>
                <cell>99</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#E0E0FF">
                <cell>U.K.</cell>
                <cell>81</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#C0C0FF">
                <cell>Canada</cell>
                <cell>41</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#E0E0FF">
                <cell>Germany</cell>
                <cell>40</cell>
            </set>
            <set border="1" border_color="silver" bg_color="#C0C0FF">
                <cell>France</cell>
                <cell>40</cell>
            </set>
            <set name="dataset" col="+1"/>
        </set>
        <chart pos="D3" type="area" x="10" y="10" width="0.7" height="0.7">
            <data values="dataset"/>
        </chart>
    </worksheet>
</workbook>
the same result.
The same way, we may take data cells from some row.
Pay attention, we use the row attribute in the virtual set now.
The row="+1" attribute means we take data from second row of the wrapping set. (blue area)
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet pos="B2" name="Market">
        <set>
            <cell bold="yes" trunc="yes">
                Holiday week downloads (millions)
            </cell>
        </set>
        <set bg_color="#E0E0FF" border_color="silver">
            <set border="1">
                <cell>U.S.</cell>
                <cell>509</cell>
            </set>
            <set border="1">
                <cell>China</cell>
                <cell>99</cell>
            </set>
            <set border="1">
                <cell>U.K.</cell>
                <cell>81</cell>
            </set>
            <set border="1">
                <cell>Canada</cell>
                <cell>41</cell>
            </set>
            <set border="1">
                <cell>Germany</cell>
                <cell>40</cell>
            </set>
            <set border="1">
                <cell>France</cell>
                <cell>40</cell>
            </set>
            <set name="dataset" row="+1"/>
        </set>
        <chart pos="B5" type="area" x="7" y="7" width="0.7" height="0.7">
            <data values="dataset"/>
        </chart>
    </worksheet>
</workbook>
Let's add user specified categories (X axis) and a series name to the data tag.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="abscissa" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="ordinate" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
        </set>
        <chart pos="D2" type="area" x="20" width="0.7" height="0.9">
            <data categories="abscissa" values="ordinate" name="Test data series 1"/>
        </chart>
    </worksheet>
</workbook>
Same as previous chart but with title and axes labels, which were added by means x_axis and y_axis tags.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="abscissa" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="ordinate" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
        </set>
        <chart pos="D2" type="area" x="20" width="0.7" height="0.9">
            <data categories="abscissa" values="ordinate" name="Test data series 1"/>
            <title name="Results of sample analysis"/>
            <x_axis name="Sample number"/>
            <y_axis name="Sample length (cm)"/>
        </chart>
    </worksheet>
</workbook>
Same as previous chart but with one more series and with chart sheet name.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="scale" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="dataset1" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
            <set name="dataset2" bg_color="#B0B0FF">
                <cell>3</cell>
                <cell>6</cell>
                <cell>7</cell>
                <cell>5</cell>
                <cell>4</cell>
                <cell>3</cell>
            </set>
        </set>
        <chart pos="E2" name="Results Chart" type="area" x="20" width="0.7" height="0.9">
            <data categories="scale" values="dataset1" name="Test data series 1"/>
            <data categories="scale" values="dataset2" name="Test data series 2"/>
            <title name="Results of sample analysis"/>
            <x_axis name="Sample number"/>
            <y_axis name="Sample length (cm)"/>
        </chart>
    </worksheet>
</workbook>

Example 25. Bar chart

A minimal bar chart.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" name="dataset" type="col">
            <cell>1</cell>
            <cell>4</cell>
            <cell>5</cell>
            <cell>2</cell>
            <cell>1</cell>
            <cell>5</cell>
        </set>
        <chart pos="C2" type="bar" x="20" width="0.7" height="0.7">
            <data values="dataset"/>
        </chart>
    </worksheet>
</workbook>
A minimal chart with user specified categories (Y axis) and a series name.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="category" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="amount" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
        </set>
        <chart pos="D2" type="bar" x="20" width="0.7" height="0.9">
            <data categories="category" values="amount" name="Test data series 1"/>
        </chart>
    </worksheet>
</workbook>
Same as previous chart but with added title and axes labels.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="number" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="lenght" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
        </set>
        <chart pos="D2" type="bar" x="20" width="0.7" height="0.9">
            <data categories="number" values="lenght" name="Test data series 1"/>
            <title name="Results of sample analysis"/>
            <x_axis name="Sample number"/>
            <y_axis name="Sample length (cm)"/>
        </chart>
    </worksheet>
</workbook>
Same as previous chart but with an added series and with a user specified chart sheet name.
<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="scale" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="dataset1" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
            <set name="dataset2" bg_color="#B0B0FF">
                <cell>3</cell>
                <cell>6</cell>
                <cell>7</cell>
                <cell>5</cell>
                <cell>4</cell>
                <cell>3</cell>
            </set>
        </set>
        <chart pos="E2" name="Results Chart" type="bar" x="20" width="0.7" height="0.9">
            <data categories="scale" values="dataset1" name="Test data series 1"/>
            <data categories="scale" values="dataset2" name="Test data series 2"/>
            <title name="Results of sample analysis"/>
            <x_axis name="Sample number"/>
            <y_axis name="Sample length (cm)"/>
        </chart>
    </worksheet>
</workbook>

Example 26. Column chart

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="scale" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="dataset1" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
            <set name="dataset2" bg_color="#B0B0FF">
                <cell>3</cell>
                <cell>6</cell>
                <cell>7</cell>
                <cell>5</cell>
                <cell>4</cell>
                <cell>3</cell>
            </set>
        </set>
        <chart pos="E2" name="Results Chart" type="column" x="20" width="0.7" height="0.9">
            <data categories="scale" values="dataset1" name="Test data series 1"/>
            <data categories="scale" values="dataset2" name="Test data series 2"/>
            <title name="Results of sample analysis"/>
            <x_axis name="Sample number"/>
            <y_axis name="Sample length (cm)"/>
        </chart>
    </worksheet>
</workbook>

Example 27. Line chart

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set pos="B2" width="5" border="1" border_color="silver">
            <set name="scale" bg_color="#D0D0FF">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="dataset1" bg_color="#C0C0FF">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
            <set name="dataset2" bg_color="#B0B0FF">
                <cell>3</cell>
                <cell>6</cell>
                <cell>7</cell>
                <cell>5</cell>
                <cell>4</cell>
                <cell>3</cell>
            </set>
        </set>
        <chart pos="E2" name="Results Chart" type="line" x="20" width="0.7" height="0.9">
            <data categories="scale" values="dataset1" name="Test data series 1"/>
            <data categories="scale" values="dataset2" name="Test data series 2"/>
            <title name="Results of sample analysis"/>
            <x_axis name="Sample number"/>
            <y_axis name="Sample length (cm)"/>
        </chart>
    </worksheet>
</workbook>

Example 27. Pie chart

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set bold="yes">
            <cell>Category</cell>
            <cell>Values</cell>
        </set>
        <set type="col">
            <set>
                <cell>Apple</cell>
                <cell>60</cell>
            </set>
            <set>
                <cell>Cherry</cell>
                <cell>30</cell>
            </set>
            <set>
                <cell>Pecan</cell>
                <cell>10</cell>
            </set>
            <set name="category" col="+0"/>
            <set name="data" col="+1"/>
        </set>
        <chart pos="D1" name="Popular Pie Types" type="pie" width="0.6" height="1.0">
            <data categories="category" values="data" name="Pie sales data"/>
            <title name="Popular Pie Types"/>
        </chart>
    </worksheet>
</workbook>

Example 28. Scatter chart

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set bold="yes">
            <cell>Category</cell>
            <cell>Values 1</cell>
            <cell>Values 2</cell>
        </set>
        <set>
            <set name="category">
                <cell>2</cell>
                <cell>3</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>6</cell>
                <cell>7</cell>
            </set>
            <set name="values1">
                <cell>1</cell>
                <cell>4</cell>
                <cell>5</cell>
                <cell>2</cell>
                <cell>1</cell>
                <cell>5</cell>
            </set>
            <set name="values2">
                <cell>3</cell>
                <cell>6</cell>
                <cell>7</cell>
                <cell>5</cell>
                <cell>4</cell>
                <cell>3</cell>
            </set>

        </set>
        <chart pos="E2" name="Results Chart" type="scatter" width="0.7" height="1.0">
            <data categories="category" values="values1" name="Test data series 1"/>
            <data categories="category" values="values2" name="Test data series 2"/>
            <title name="Results of sample analysis"/>
            <x_axis name="Sample number"/>
            <y_axis name="Sample length (cm)"/>
        </chart>
    </worksheet>
</workbook>

Example 29. Stock chart

<?xml version="1.0"?>
<!DOCTYPE workbook SYSTEM "xml_to_xls.dtd">
<workbook>
    <worksheet>
        <set bold="yes" width="6">
            <cell width="10">Date</cell><cell>Open</cell><cell>High</cell><cell>Low</cell><cell>Close</cell>
        </set>
        <set type="col">
            <set><cell>2009-08-19</cell><cell>100.00</cell><cell>104.06</cell><cell>95.96</cell> <cell>100.34</cell></set>
            <set><cell>2009-08-20</cell><cell>101.01</cell><cell>109.08</cell><cell>100.50</cell><cell>108.31</cell></set>
            <set><cell>2009-08-23</cell><cell>110.75</cell><cell>113.48</cell><cell>109.05</cell><cell>109.40</cell></set>
            <set><cell>2009-08-24</cell><cell>111.24</cell><cell>111.60</cell><cell>103.57</cell><cell>104.87</cell></set>
            <set><cell>2009-08-25</cell><cell>104.96</cell><cell>108.00</cell><cell>103.88</cell><cell>106.00</cell></set>
            <set><cell>2009-08-26</cell><cell>104.95</cell><cell>107.95</cell><cell>104.66</cell><cell>107.91</cell></set>
            <set><cell>2009-08-27</cell><cell>108.10</cell><cell>108.62</cell><cell>105.69</cell><cell>106.15</cell></set>
            <set><cell>2009-08-30</cell><cell>105.28</cell><cell>105.49</cell><cell>102.01</cell><cell>102.01</cell></set>
            <set><cell>2009-08-31</cell><cell>102.30</cell><cell>103.71</cell><cell>102.16</cell><cell>102.37</cell></set>
            <set name="date" col="+0"/>
            <set name="open" col="+1"/>
            <set name="high" col="+2"/>
            <set name="low" col="+3"/>
            <set name="close" col="+4"/>
        </set>
        <chart pos="F2" name="Results Chart" x="10" type="stock" width="1.2">
            <data categories="date" values="open" name="Open"/>
            <data categories="date" values="high" name="High"/>
            <data categories="date" values="low" name="Low"/>
            <data categories="date" values="close" name="Close"/>
            <title name="Open-High-Low-Close"/>
            <x_axis name="Date"/>
            <y_axis name="Share price"/>
        </chart>
    </worksheet>
</workbook>

The Spreadsheet::XML_to_XLS module is not an example of programming art. I wrote it to solve certain tasks in my current project. And I hope, the module will be useful for you also. It would be great if you let me know what additional functionality do you need in your project, send me an example of XML file, which the module fails to treat, report discovered defects.

Regards,

Radik Usmanov

radik.usmanov@ubs.com,
rusmanov@luxoft.com.