You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Harsha <sr...@gmail.com> on 2014/02/19 06:05:37 UTC

Merged rows with content | content should fit to merged region, content should not exceed the region or which space should not be seen

Hi,

We have dynamic content to be displayed in excel(xlsx) file. First couple of
rows will have table data after table data we need to show text(in merged
region). There will not be any limit to the character count. 

We used below snippet to create merged cell region
Lets say table rows are 10 and columns are 5 (these are not constants)
XSSFSheet xssfSheet; //valid xssfSheet
int firstRow; //row after table data. table rows + 2, so firstRow will be 12
int lastRow; // firstRow+<...> (we have some custom logic to identify this)  
int firstCol; //always 0
int lastCol; // table column size lastCol will be 5, (table columns )
CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol,
lastCol);
xssfSheet.addMergedRegion(region);

>From above snippet lastRow is being calculated using total number of
characters and some other stuff and then determining the lastRow value to
show content fit to merged region. (sometimes content fits to merged region,
sometimes content overflows the region and sometimes content is less and
white space appears). I am sure this is not elegant way to do it. I couldn't
find any other way.

I need to understand what would be the right way to fit the content in
merged region without content overflow or too much white space.  (Content
can have rich text with line feeds different fonts and etc. which are taken
care)

Any help would be appreciative 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Merged-rows-with-content-content-should-fit-to-merged-region-content-should-not-exceed-the-region-orn-tp5714982.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: Merged rows with content | content should fit to merged region, content should not exceed the region or which space should not be seen

Posted by Harsha <sr...@gmail.com>.
Any clues or pointers would be appreciative.

Thanks



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Merged-rows-with-content-content-should-fit-to-merged-region-content-should-not-exceed-the-region-orn-tp5714982p5716470.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