You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by FredJ <ff...@gmail.com> on 2012/05/27 23:34:08 UTC

mapping binary tree to excel

Folks, I have a binary tree that is composed of: ( Folers, Files within
folders, and Fields within files, and field attributes like colors and types
within each field).

Now, I want to map this tree structure to EXCEL through PO, or any other
available API with attributes and links in each cell, and I would click to
drill down to through this tree.

How do I approach this problem though any kind of API ( IE: POI)????

Anybody would like to point me to a right direction???

Thanks in advance.

Fred

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/mapping-binary-tree-to-excel-tp5709943.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: mapping binary tree to excel

Posted by FredJ <ff...@gmail.com>.
Excellent Mark,  you gave me very good ideas to start pursuing.

Will work on it, and will let you know where that takes me.

Thanks again for your response and effort.

Fred

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/mapping-binary-tree-to-excel-tp5709943p5709972.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: mapping binary tree to excel

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
I can only think of two ways using POI, one of which I do not know would even
be possible.

The first would involve a great deal of work as you would be using
hyperlinks (http://poi.apache.org/spreadsheet/quick-guide.html#Hyperlinks);
clicking on a hyperlink would allow you to go down a level of detail within
the file system by 'taking' you onto a different sheet within a different
workbook (probably). All of the hyperlinks will have to be created manually
and positioned on the sheets which will themselves have to be created
manually. To automate the process, you could parse something like an xml
file which contains markup that describes the tree structure. Assuming you
have something like this to hand, your code could contain rules that say,
for example, 'when you encounter a new folder, create a new workbook'. Of
course you are not limited to xml but you do need some descriptive structure
that your code can walk through, interpreting the instructions it contains
and creating the workbooks in response.

There is a part two of the first option as well. Take a look at the concept
of outlining (http://poi.apache.org/spreadsheet/quick-guide.html#Outlining).
I can imagine this being used to describe one level of information within a
folder. Still going to be quite complex to work out the structure though.
Still, you are going to have to write the code that will walk through the
description of the file structure and converts it into a representation on
the worksheets using POI.

Option two would be to use an object - such as a directory browser which i
am sure that someone somewhere has implemented in Java - and to embed that
into a cell on a workbook as a control. If that is possible - and that is an
if as I have never tried anything like this at all - then the control can
manage the task of browsing the file structure. The one limitation that I
can think of with regard to this is that the file structure must be live -
i.e. it must physically exist somewhere rather than being a description of a
file structure. Furthermore, I think that you would have to use one of
Microsoft's visual tols for something like this or work with Excel itself
directly. They make controls available which you can position onto a
worksheet. 

Best place to start in my opinion is not with POI. Have you tried to realise
the sort of structure you require using Excel yet? All you need to do is
work with Excel directly to build something like you - or your employer -
wishes to see. If it is possible using Excel then it should be possible
using POI. That is always where I would start when faced with a task like
this one as you may find it simply is not possible to achieve what you are
after using Excel and then, of course, no amount of time working with POI
will change that. If it is possible using Excel, then you know what you want
to do and have agood idea of where to start working with the API.

Also, it may be worthwhile looking for graphical tools that *do* allow you
to represent a tree like structure. Java has one in the form of the JTree
(http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html) and I
can imagine how this could be used to do exactly what you are after.
Construct an object to hold the tree's data (the model which describes the
file structure and would, possibly, be something ike a series of linked
ArrayLists) and simply pass it to the JTree which controls the process of
displaying other levels to the user and handling their interactions with the
data (the old Model View Controller pattern). I have never tried this but
you might even be able to embed the JTree into a web page and then embed
that web page into a sheet. Might be worth a punt I guess. Also, it is well
worth looking to see if anyone offers a tree control that can be embedded
directly into a web page. This control may expose an interface that you can
interact with using Java and it might - that is a big might - even be
possible to work with the control through POI.

Do not know if any of this helps.

Yours

Mark B

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/mapping-binary-tree-to-excel-tp5709943p5709951.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: mapping binary tree to excel

Posted by FredJ <ff...@gmail.com>.
Thanks Evgeniy,

I don't know if I asked the question correctly.
I have a binary tree, like microsoft file explorer, the you show folder, and
files.  You know, let's say we have folder d1 that contains folder d11 and
folder d12.  folder d12 that contains file d121 and file d122. foler d11
contains file f111 and file f112.  And file f111 that contains file f1111
and folder d1112.

SO this is a file system and things just keep on going like this.  

Now, I want to ask you, could we implement this file system on an excel
sheet.  Where we can expan it, and colapse it and all of that fancyness.  If
this was a java program like swing, we could do that, but I don't know how
we accomplish that through excel.

So the problem is: How do we map a binary tree ( IE: a file sytem that I
explained to you) to an EXCEL???

Thanks, 

Fred

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/mapping-binary-tree-to-excel-tp5709943p5709948.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: mapping binary tree to excel

Posted by Evgeniy Berlog <su...@gmail.com>.
28.05.2012 0:34, FredJ написал:
> Folks, I have a binary tree that is composed of: ( Folers, Files within
> folders, and Fields within files, and field attributes like colors and types
> within each field).
>
> Now, I want to map this tree structure to EXCEL through PO, or any other
> available API with attributes and links in each cell, and I would click to
> drill down to through this tree.
>
> How do I approach this problem though any kind of API ( IE: POI)????
>
> Anybody would like to point me to a right direction???
>
> Thanks in advance.
>
> Fred
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/mapping-binary-tree-to-excel-tp5709943.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
Hi, Fred
Can you explain me what structure of Excel file would you like to have?
It would be best if you create manually .xls or .xlsx file with needed 
structure and show in example corresponding folders and files.
Also can you send me example of .xls file and archive with several 
folders and files which must be mapped to excel file?

I will try to help as soon as possible.

With best regards
Evgeniy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org