Bug 9633

Summary: RFE: Apply border to merged cell
Product: POI Reporter: Eric Pugh <epugh>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 2.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: A contribution from someone on the user list

Description Eric Pugh 2002-06-05 14:36:55 UTC
>I want to put a board around the edge of a merged cell..  I don't really
>want to get the region dimension and then figure out which cells need which
>boards...  Right now, I put a complete box boarder around the original cell,
>then merge it, and the outer edges of the original cell show through...  It
>would be nice to apply styles to regions...
>  
>
I checked, and it does appear that you can do this in excel.  My next 
question will of course be "Is excel actually
doing this or just setting the format to the boarder for each of the 
cells" but I'll not have time to look at this for a little while.
(swamped).  Please put this in bugzilla with [RFE] in the subject, and 
target for 2.0-dev and I'll look at it more later.
Comment 1 Glen Stampoultzis 2002-07-20 12:40:12 UTC
Okay, I've done some research on this.  What excel does is create blank and
mulblank records in the merged cells so that it can apply the styles for the
borders.  As a workaround you could probably use blank cells do this yourself
but POI should probably:

1. provide some sort of ability to apply these sorts of operations to ranges.
2. (maybe) extend existing styles to the merged cells.
Comment 2 Mark Thomas 2009-06-10 13:28:07 UTC
Reset assignee.
Comment 3 David Fisher 2009-06-10 14:09:22 UTC
Hi,

(1) This feature is available in HSSF in POI 3.5 using HSSFRegionUtil.

(2) It is not yet available on XSSF. This was noted by someone on the user list. They attached a patch to their email, and I have reattached it here.

Here is the text of the email and the self-reply.

Hi

I did not find any utility classes for XSSF , hence I just took the two classes for HSSF and migrated them so that they can be used with both XSSF and HSSF using the ss usermodel.

I have included the source code here if anyone wants to use it and if the primary authors would like to add this 
to the next POI distribution.I do not know how can I get this into the codebase but I think this might be useful to someone working with merged regions in the new XML styled workbooks.


I think these classes can replace the HSSFRegionUtil and HSSFCellUtil class.

Regards
A


-----Original Message-----
From: Avinash Kewalramani [mailto:AKewalramani@accelrys.com] 
Sent: Thursday, January 22, 2009 10:17 AM
To: POI Users List
Subject: Setting boreders types and colors around merged regions

Hi

Is there a utility class for setting border color and styles around a merged region of cells in XSSF?
I see from the documentation that there are utility classes like HSSFRegionUtil and HSSFCellutil
for doing this on the HSSF side. Is there something parallel/similar for working with XSSF worksheets?

Thanks and Regards
A
Comment 4 David Fisher 2009-06-10 14:10:37 UTC
Created attachment 23790 [details]
A contribution from someone on the user list
Comment 5 Josh Micich 2009-06-10 15:36:17 UTC
(In reply to comment #4)
> Created an attachment (id=23790) [details]
> A contribution from someone on the user list

Thanks Dave.

applied in svn r783554

This code is still part of the contrib sub-project.  It seems like it is stable (and well understood) enough to be moved into src/java