Thanks Yegor.
Will try to get the data accordingly.

AK



On Mon, Sep 10, 2012 at 4:40 PM, Yegor Kozlov <[email protected]> wrote:

> The best way to explore the POIFS tree is
> org.apache.poi.poifs.poibrowser.POIBrowser  from poi-examples. This
> utility provides a user-friendly UI to explore the OLE2 file systems
> of binary office formats.
>
> Once you know id of the chart data stream you can read it as follows:
>
>         HWPFDocument doc = new HWPFDocument(dataStream);
>         ObjectsPool objects = doc.getObjectsPool(); // storage of
> emebedded objects
>
>         // get a specific node for id="_1408793253"
>         DirectoryNode embeddedDoc =
> (DirectoryNode)objects.getObjectById("_1408793253");
>         // make sense of the embedded data
>         HSSFWorkbook wb = new HSSFWorkbook(embeddedDoc , true);
>
>         // note that you can safe the embedded data to disk as a .xls
> file and view it in Excel
>
> How to get chart ids programmatically is up to you. According to the
> docs, the naming convention is "_" + objId  where objId is the name of
> the OLE object storage in hex format.
> The id can be retrieved from CharacterRun objects as follows:
>
> String objId = "_" + characterRun.getPicOffset();
>
> So to get chart you need to first identify the chart object in the
> document, get its OLE id from the corresponding CharacterRun and then
> grab the data from ObjectsPool .
>
> Hope it helps.
>
> Yegor
>
>
> On Mon, Sep 10, 2012 at 1:21 PM, AK <[email protected]> wrote:
> > Hi Yegor,
> >
> > Yes it is an Embed object. Am not able to get the proper information
> about
> > the chart. Can u bit elaborate, how to traverse the tree and get the
> data?
> >
> > AK
> >
> > On Mon, Sep 10, 2012 at 12:51 PM, Yegor Kozlov <[email protected]
> >wrote:
> >
> >> Charts in HWPF are not yes suported. My hunch is that charts are
> >> stored as nodes in the underlying POIFS tree. Walk it and see if it is
> >> so.
> >> Then grab the data, see what format it is (mostr likely xls) and make
> >> sense if it.
> >>
> >> Yegor
> >>
> >> On Mon, Sep 10, 2012 at 10:01 AM, AK <[email protected]> wrote:
> >> > HI,
> >> >
> >> > Can anyone tell me how to get the embeded chart data from the 2003
> word?
> >> >
> >> > Thanks,
> >> > AK
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to