You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Tapan Ghia <ta...@yahoo.co.in> on 2008/08/11 15:29:51 UTC

Unmerge cells : for a complete Excel Sheet

Hey..

I have an Excel Sheet and when I try to do operations like Sorting on some columns , and this gives me a merged cells Error, which does not allow me to sort the Excel sheets .
The exact error says:
The cell range that you attempted to sort or remove duplicates from includes merged cells. However not all cells in the range are merged to the same size.
To complete this operation, unmerge all the merged cells in the range, or make each group of merged cells the same size as the largest group.

As I am generating these Excel Sheets programatically I want to unmerge all the cells in the Excel Sheet in the code itself.

Can please someone suggest me an efficient and easy way to do this??

Thanks
       
---------------------------------
 Unlimited freedom, unlimited storage. Get it now

Re: Unmerge cells : for a complete Excel Sheet

Posted by David Fisher <df...@jmlafferty.com>.
Hah! Thanks for the chuckle.

(I started this with another joke, but then, well this is a serious  
question, and it is a difficult question that has occupied a  
significant amount of my team's development efforts over the past  
three years.)

The OP may have no control over the output and is being asked to do  
the "impossible."

Maybe the OP needs to "guide" the users sorting activities to avoid  
the necessarily merged cells. If this guidance is simple then  
instructions about how to select regions to do a sort  ought to do it.  
But maybe the steps to perform custom sorts that skip over merged  
cells is too complicated for the spreadsheet's users.

There is a way to do this by manipulating the file format outside of  
Excel. The only way is to manipulate the file format inside of Excel.  
So the solution can not be an open source, java way. It must be done  
in Microsoft's way.

The solution will be to write a COM Add-in to add a toolbar or menu to  
Excel to perform the sorts on a suitable worksheet. That requires  
Visual Studio and .Net. The c# language is then preferred. You can  
talk to your Java webapp server that way as well.

But now we are getting well out of the realm of POI, unless we want to  
change POI's mission.

Regards,
Dave

On Aug 11, 2008, at 12:09 PM, Anthony Andrews wrote:

> This may sound trite but as you are generating the sheets yourself,  
> simply remove the bit of code that actually merges the cells that  
> are causing you problems.
>
> --- On Mon, 8/11/08, Tapan Ghia <ta...@yahoo.co.in> wrote:
> From: Tapan Ghia <ta...@yahoo.co.in>
> Subject: Unmerge cells : for a complete Excel Sheet
> To: "poi apache community" <us...@poi.apache.org>
> Date: Monday, August 11, 2008, 6:29 AM
>
> Hey..
>
> I have an Excel Sheet and when I try to do operations like Sorting  
> on some
> columns , and this gives me a merged cells Error, which does not  
> allow me to
> sort the Excel sheets .
> The exact error says:
> The cell range that you attempted to sort or remove duplicates from  
> includes
> merged cells. However not all cells in the range are merged to the  
> same size.
> To complete this operation, unmerge all the merged cells in the  
> range, or make
> each group of merged cells the same size as the largest group.
>
> As I am generating these Excel Sheets programatically I want to  
> unmerge all the
> cells in the Excel Sheet in the code itself.
>
> Can please someone suggest me an efficient and easy way to do this??
>
> Thanks
>
> ---------------------------------
> Unlimited freedom, unlimited storage. Get it now
>
>


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


Re: Unmerge cells : for a complete Excel Sheet

Posted by Anthony Andrews <py...@yahoo.com>.
This may sound trite but as you are generating the sheets yourself, simply remove the bit of code that actually merges the cells that are causing you problems.

--- On Mon, 8/11/08, Tapan Ghia <ta...@yahoo.co.in> wrote:
From: Tapan Ghia <ta...@yahoo.co.in>
Subject: Unmerge cells : for a complete Excel Sheet
To: "poi apache community" <us...@poi.apache.org>
Date: Monday, August 11, 2008, 6:29 AM

Hey..

I have an Excel Sheet and when I try to do operations like Sorting on some
columns , and this gives me a merged cells Error, which does not allow me to
sort the Excel sheets .
The exact error says:
The cell range that you attempted to sort or remove duplicates from includes
merged cells. However not all cells in the range are merged to the same size.
To complete this operation, unmerge all the merged cells in the range, or make
each group of merged cells the same size as the largest group.

As I am generating these Excel Sheets programatically I want to unmerge all the
cells in the Excel Sheet in the code itself.

Can please someone suggest me an efficient and easy way to do this??

Thanks
       
---------------------------------
 Unlimited freedom, unlimited storage. Get it now