You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by dpmihai <dp...@yahoo.com> on 2012/07/18 13:33:39 UTC

How to deal with layout/sub-layout poi usage?

I want to generate an excel file with apache poi.

I have a layout of type:

|  C1  |  C2  |  C3  |
|  C4  |  sub-layout |
|  C5  |       C6      |

where C are data cells and sub-layout is a dynamic layout like

|  S1  |  S2  |  S3  |
|       S4      |  S5  |

with any possible number of rows and columns.

For a simple excel generation where there is no sub-layout, the process is
straight-forward:

Create a HSSFWorkbook  , create a HSSFSheet and then the layout is read and
a HSSFRow is created for every row, and then HSSFCell cells (with necessary
merged regions if any)

I see HSSFCell cannot contain a group (table) of cells. So what is the best
way of writing an excel file starting from a layout&sublayout  structure?





--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-deal-with-layout-sub-layout-poi-usage-tp5710483.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: How to deal with layout/sub-layout poi usage?

Posted by dpmihai <dp...@yahoo.com>.
I found some link to copy a sheet to another one:

http://www.coderanch.com/t/420958/open-source/Copying-sheet-excel-file-another

The idea is to generate  a HSSFSheet for the sub-layout and then insert it
at necessary position in the master sheet. It is not a very general
solution, but it is the only one I can think of.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-deal-with-layout-sub-layout-poi-usage-tp5710483p5710497.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: How to deal with layout/sub-layout poi usage?

Posted by dpmihai <dp...@yahoo.com>.
To be more clear, in HTML it is possible to enter an entire  table inside a
td element.

As far as I know Excel does not support nested tables (to put a group of
cells inside a cell).

So my question is about the possibility to create an excel file starting
from a layout/sublayout structure.

I think it is very difficult to create a structure like :

|    x    |    x    |
|  y  |  y  |  y  |

Even if I compute how many rows and columns my sub-layout extends , i do not
know how to make the entire excel looking aligned.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-deal-with-layout-sub-layout-poi-usage-tp5710483p5710493.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: How to deal with layout/sub-layout poi usage?

Posted by dpmihai <dp...@yahoo.com>.
To be more clear, in HTML it is possible to enter an entire 
 inside a 	.

As far as I know Excel does not support nested tables (to put a group of
cells inside a cell).

So my question is about the possibility to create an excel file starting
from a layout/sublayout structure. 

I think it is very difficult to create a structure like :

|    x    |    x    |
|  y  |  y  |  y  |

Even if I compute how many rows and columns my sub-layout extends , i do not
know how to make the entire excel looking aligned.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-deal-with-layout-sub-layout-poi-usage-tp5710483p5710492.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: How to deal with layout/sub-layout poi usage?

Posted by Yegor Kozlov <ye...@dinom.ru>.
http://poi.apache.org/spreadsheet/quick-guide.html#MergedCells

On Wed, Jul 18, 2012 at 3:33 PM, dpmihai <dp...@yahoo.com> wrote:
> I want to generate an excel file with apache poi.
>
> I have a layout of type:
>
> |  C1  |  C2  |  C3  |
> |  C4  |  sub-layout |
> |  C5  |       C6      |
>
> where C are data cells and sub-layout is a dynamic layout like
>
> |  S1  |  S2  |  S3  |
> |       S4      |  S5  |
>
> with any possible number of rows and columns.
>
> For a simple excel generation where there is no sub-layout, the process is
> straight-forward:
>
> Create a HSSFWorkbook  , create a HSSFSheet and then the layout is read and
> a HSSFRow is created for every row, and then HSSFCell cells (with necessary
> merged regions if any)
>
> I see HSSFCell cannot contain a group (table) of cells. So what is the best
> way of writing an excel file starting from a layout&sublayout  structure?
>
>
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-deal-with-layout-sub-layout-poi-usage-tp5710483.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
>

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