The exact same thing happens with Excel as well - the border was the only
formatting not preserved after I merged the cells - and the only suggestion
I can make is to delay setting the cells style until after you have merged
the cells together. Browsing through the javadocs, I cannot see anything
that makes it possible to set the style on a merged region and I am hoping
that if you create the cells, add the data to the first, merge the cells
together and then set the style object on that first cell following the
merge operation then HSSF/XSSF will interpret this as being applied to the
merged region - hoping!

Sorry to say I cannot test this hypothesis myself before leaving for work
today.


Maurya, Dilip wrote:
> 
> I have 2 cells in a sheet one below other. One cell has some data with
> style applied; the other cell has neither data nor any style. Cells are
> then merged using:
> 
> sheet.addMergedRegion(new CellRangeAddress(1,2,2,2));
> 
>  
> 
> The cells get merged and data is shown correctly, but the styles are
> semi-merged. In the sense that foreground color, font and font color are
> applied but borders are not. The lower half of the merged cell still
> retains the borders. Check the image attached.
> 
>  
> 
> Thanks,
> 
> Dilip
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

-- 
View this message in context: 
http://www.nabble.com/Merged-Cells.-tp23283423p23291257.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to