poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adeel khan <ak1...@gmail.com>
Subject Re: [GSoC 2012] POI: Implement support for Excel charts
Date Fri, 06 Apr 2012 06:11:15 GMT

On Mon, Apr 2, 2012 at 6:32 PM, Yegor Kozlov <yegor.kozlov@dinom.ru> wrote:

> > I want to know is there is any existing implementation for any single
> chart
> > that works. As i see the code base there is some code for charts both for
> > binary and xml format. I want to know that the code is in what state?
> >
> There is initial support for charts for the .xlsx format.
> Have a look at this example:
> https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/ScatterChart.java
> The example is functional and it is a very good starting point to
> support more types of charts.
> Notice how it is implemented: there is a set of common spreadsheet
> interfaces (Chart, ChartAxis, ChartLegend, etc.)
>  and their concrete implementations in the
> org.apache.poi.xssf.usermodel.charts.* package. To support new types
> of charts
> you will need to follow the pattern: define new interfaces and add the
> implementation.

Great help from this. what i was not able to find was any such example for
binary files inside hssf. If its there some where do let me know.

> > Secondly what internal classes are use to interact with files
> > (reading,writing or changing) both for binary and xml format.
> >
> The binary Excel format consists of individual blocks called records.
> Each record contains specific data for the various contents or
> features in a document.
> There are records describing rows, cells, print areas, formulas, charts,
> etc.
> In HSSF every record is a subclass of org.apache.poi.hssf.record.Record.
> See concrete implementations in the org.apache.poi.hssf.record.* namespace.
> Typically, a record implementation has a constructor that takes a
> RecordInputStream ( it is called when a document is read)
>  and a serialize(LittleEndianOutput out)  method which is called when
> the document is saved.
> Some but not all chart-specific records are already supported:
> ChartTitleFormatRecord, ChartRecord, SeriesTextRecord, etc.
> Have a look at their implementations.

Well there is a complete folder for chart inside
org.apache.poi.hssf.record.* These files should have some relation to chart.

> For the OOXML formats POI uses XmlBeans (http://xmlbeans.apache.org)
> to build XML and
> all operations that modify the document delegate the actual
> construction of XML to Xmlbeans.
> For example, the XSSFSheet object holds the root element of the
> SpreadsheetML Sheet part (CTWorksheet ) and
> the piece of code that appends a new row looks as follows:
> CTRow row = worksheet.getSheetData().addNewRow();
> All the heavy lifting happens behind the scene and you don't have to
> deal with low-level XML.

Good to know that . What i got from source code is that using the XmlBean
we can able to create objects for each named xml element or complex type
and its gives you the facility to add things to it which is actually adding
stuff to that element. eg lets support if i create an instance of
CTChartSpace then it would also have an instance of CTChart which can be
used to populate stuff for chart. Each Classes in some way are acting as
wrapper for these complex data types or some times holding more than one
creating/instantiating more than one type.

> OOXML files are zip archives and the best way to learn OOXML is to
> unzip a document and view its structure in a XML editor.
> it is also useful for reverse-engineering: create a spreadsheet with a
> chart in Excel, unzip the file and see what XML structures were
> created.

yup already did this and its helps a lot.

> You should demonstrate that you understand the required amount of work
> and have technical skills to complete it.
> Basic understanding of the BIFF8 and SpreadsheetML format are
> pre-requisites in my opinion.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message