nicolaken 02/04/18 09:21:10
Modified: src/documentation/xdocs/userdocs/serializers book.xml
serializers.xml
Added: src/documentation/xdocs/userdocs/serializers
xls-serializer.xml
Log:
Doc patch 8068 from [EMAIL PROTECTED]
" It also includes the documentation for the HSSF Serialzier
(Adapted from the original HOWTO). Documentation for the HSSF Serializer with
the sent in samples, this doc is now officially adequate."
Revision Changes Path
1.2 +1 -0
xml-cocoon2/src/documentation/xdocs/userdocs/serializers/book.xml
Index: book.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/serializers/book.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- book.xml 3 Jan 2002 12:31:05 -0000 1.1
+++ book.xml 18 Apr 2002 16:21:10 -0000 1.2
@@ -31,6 +31,7 @@
<menu-item label="PDF Serializer" href="pdf-serializer.html"/>
<menu-item label="PS Serializer" href="ps-serializer.html"/>
<menu-item label="PCL Serializer" href="pcl-serializer.html"/>
+ <menu-item label="HSSF (XLS) Serializer" href="xls-serializer.html"/>
</menu>
</book>
1.2 +1 -0
xml-cocoon2/src/documentation/xdocs/userdocs/serializers/serializers.xml
Index: serializers.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/serializers/serializers.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- serializers.xml 3 Jan 2002 12:31:05 -0000 1.1
+++ serializers.xml 18 Apr 2002 16:21:10 -0000 1.2
@@ -27,6 +27,7 @@
<li><link href="html-serializer.html">HTML
Serializer</link> (The default serializer)</li>
<li><link href="xml-serializer.html">XML
Serializer</link></li>
<li><link href="text-serializer.html">Text
Serializer</link></li>
+ <li><link
href="xls-serializer.html">HSSF (XLS) Serializer</link> (optional)</li>
<li><link href="pdf-serializer.html">PDF
Serializer</link> (optional)</li>
<li><link href="ps-serializer.html">PS
Serializer</link> (optional)</li>
<li><link href="pcl-serializer.html">PCL
Serializer</link> (optional)</li>
1.1
xml-cocoon2/src/documentation/xdocs/userdocs/serializers/xls-serializer.xml
Index: xls-serializer.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
<title>XML Serializer</title>
<version>0.9</version>
<type>Technical document</type>
<authors>
<person name="Andrew C. Oliver" email="[EMAIL PROTECTED]"/>
<person name="Marcus W. Johnson"
email="[EMAIL PROTECTED]"/>
</authors>
<abstract>This document describes the HSSF serializer of
Cocoon.</abstract>
</header>
<body>
<s1 title="HSSF Serializer">
<p>The HSSF serializer is the catches SAX events and creates a
spreadsheet in the XLS format used by Microsoft Excel (but
the output looks just dandy in
<link
href="http://www.gnome.org/gnumeric">Gnumeric</link> or
<link
href="http://www.openoffice.org">OpenOffice.org</link>
as well). The HSSF Serializer expects data in the
same tag language as the popular spreadsheet progam
Gnumeric. You can locate schemas and dtd's for this
format on the gnumeric website or in it's CVS
repository. One of the easiest ways to use the HSSF
Serializer is to create a spreadsheet using Gnumeric
and then refactor it into an XSLT page.
</p>
<p>The HSSF Serializer supports most of the
functionalities supported by the
<link href="http://jakarta.apache.org/poi/hssf">HSSF
API</link> which is part of the <link
href="http://jakarta.apache.org/poi">Jakarta POI
project</link>.
</p>
<ul>
<li>Name : xls</li>
<li>Class:
org.apache.cocoon.serialization.HSSFSerializer</li>
<li>Cacheable: ?</li>
</ul>
</s1>
<s1 title="Usage">
<p>Using the HSSF Serializer is fairly simple. You'll
need a sitemap of course. Once you have that well,
you're half there. Add </p>
<source>
<map:serializer name="xls"
src="org.apache.cocoon.serialization.HSSFSerializer"
mime-type="application/vnd.ms-excel"/>
</source>
<p>
to the sitemap between the map:serializers tags. Next,
set up an entry for each url or set of urls (via
matching rules) resembling this:
</p>
<source>
<map:match pattern="hello.xls">
<map:generate
src="docs/samples/hello-page.xml"/>
<map:transform
src="stylesheets/page/simple-page2xls.xsl"/>
<map:serialize type="xls"/>
</map:match>
</source>
<p>
As for the stylesheets tts best to look at the sources
for the Cocoon samples. You'll find the HSSF Serializer
examples under "Legacy Formats" from the main samples
page. You can find the source under <link
href="http://cvs.apache.org/viewcvs/xml-cocoon2/src/webapp/samples/poi/">
xml-cocoon2/src/webapp/samples/poi</link> in the Cocoon
sources.
</p>
</s1>
<s1 title="Required XML format">
<p>It is suggested that you use the sample stylesheets
as a template until you master the format. You'll probably
want to graduate from that to using Gnumeric to create
templates and adapt them into stylesheets. HSSFSerializer
assumes the XML it is serializing uses the same tag
library as the <link href="http://www.gnome.org">Gnome
project's</link>
(http://www.gnome.org) <link
href="http://www.gnome.org/gnumeric">
Gnumeric spreadsheet</link>. At this time the serializer
supports the same tags used in the 0.7-1.04 version. The
schema for this format was created by POI committer Marc
Johnson and can be found <link
href="http://cvs.gnome.org/lxr/source/gnumeric/gnumeric.xsd">
here</link>. While HSSFSerializer ignores
the bulk of the tags, it is suggested you provide at a
minimum the basic tags in the example above. As a general
rule, if Gnumeric 0.7-1.04 will load the XML (provided it
is tar'd and gzipped as expected) then the HSSFSerializer
should be able to handle it. While you can simply output
an XML document in this format via a file or some other
process (servlet/etc.), you'll probably have existing
documents you'd like to format into spreadsheets. The
best way to do this is to create a stylesheet. There are
a number of good books and references on XSLT. A good one
is Michael Kay's book from Wrox publishing so aptly
named XSLT Programmer's Reference. Another is the XSLT
book from O'Reilly. The first is good as a lookup reference.
The latter is good for concepts, etc. You can also find
a wealth of information at http://www.xml.org. The XSLT
spec is surprisingly readable.
</p>
<p>As a general guideline these tags are not ignored in
this release:
</p>
<ul>
<li>gmr:Workbook - Required, basically the root
element</li>
<li>gmr:Sheets - Required</li>
<li>gmr:Sheet - Required for each sheet</li>
<li>gmr:Name - Defines the sheet's name as it
appears on the little tabs under the
workbook in your favorite GUI spreadsheet
application.</li>
<li>gmr:MaxCol - Used to set the dimensions for
the sheet. This can be wrong and your
spreadsheet program may not care but some
other ports depend upon this, so we set it
to be compatible.</li>
<li>gmr:Cols - Used to determine the default
column width</li>
<li>gmr:ColInfo - Used to set the column width
for a specific column. (the attribute is a
misnomer, the unit is characters)</li>
<li>gmr:Rows - Used to set the default row
height in points.</li>
<li>gmr:RowInfo - Used to set the row height for
a specific row in points.</li>
<li>gmr:Cells - Required</li>
<li>gmr:Cell - defines the actual column and row
number as well as the data type.</li>
<li>gmr:Content - defines the start of the value
contained in the cell. This is obsolete as of
Gnumeric 1.03. Its still supported by HSSF, but
may not be in future versions.</li>
<li>gmr:Styles - required if StyleRegion is
used. (parent collection node)</li>
<li>gmr:StyleRegion - defines a style for a
region of the spreadsheet.</li>
<li>gmr:Style - Specifies the actaul style for a
StyleRegion. HAlign attribute specifies the
horizontal alignment and may have a value of
1 (General), 2 (Left), 4 (Right), 8 (Center),
16 (Fill),32 (Justify), or 64 (Center accross
selection). VAlign specifies the vertical
alignment (top,bottom,center,justify are 1, 2, 4
and 8 respectively). WrapText specifies whether
to wrap text around or not (0 = don't, 1 = do),
Shade is a kidna stupid flag...if you're setting
a background color and want it filled...use
Shade="1". Format is the number format to use.
Generally, Excel and Gnumeric have the same
formats.</li>
<li>Font - Font is a child of the StyleRegion.
The attirbutes are pretty darned obvious. If
you don't know what Bold or Italic mean then
well, we can't help you here.</li>
<li>StyleBorder - StyleBorder a child of the
Style tag. It contains child elements for each
border
a cell could have (Top, Bottom, Left, Right,
Diagnol) and each of these specify a border
Style and optionally a Color.</li>
</ul>
</s1>
<s1 title="Future Features">
<p>
So HSSF Serializer is well on its way to being darn near
everything you need to create fancy smancy reports in
Excel or OpenOffice. (And you can just XML Serialize the
output from your stylesheets for Gnumeric version).
</p>
<ul>
<li>Add support for formulas. (not yet supported by
HSSF)</li>
<li>Add support for custom data formats. (not yet
supported by HSSF)</li>
</ul>
</s1>
</body>
</document>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]