Unmerge Method

In Aspose.Excel, How can I unmerge a Cell/Range ?

In Office.Excel I use :

Excel.Range(“A:22”).MergeCells = False

Currently Aspose.Excel doesn’t supply such a method. I plan to add it in the next hotfix. Now thanks for your patience.

Hi

thanks.

Could you please develop this as a function that return a result
result should be a range like this :

Dim myRange As Aspose.Excel.Range
myRange = Excel.Worksheets(“Sheet1”).Cells(“B1”).Unmerge()

In this way, If the user want to merg the rang back, He could only use this command
Range.Merge()


Any news about this request ?

Hi nima,

Sorry for not adding these feature in the latest hotfix. In these days we have done many internal optimization and fixes bugs reported by other users. So it may take two weeks to suppply this feature. Thanks for your patience.

Hi nima,
Now it’s available. Have you download the hotfix?

@nima,
This is to inform you that Aspose.Excel is discontinued and no more devlopment is done now. A new product Aspose.Cells is introduced which contains all the old and new features of MS Excel. This new product is also capable of merging and unmerging cells as shown in the following sample code:

Merging Cells

// Create a Workbook.
Workbook wbk = new Workbook();

// Create a Worksheet and get the first sheet.
Worksheet worksheet = wbk.Worksheets[0];

// Create a Cells object ot fetch all the cells.
Cells cells = worksheet.Cells;

// Merge some Cells (C6:E7) into a single C6 Cell.
cells.Merge(5, 2, 2, 3);

// Input data into C6 Cell.
worksheet.Cells[5, 2].PutValue("This is my value");

// Create a Style object to fetch the Style of C6 Cell.
Style style = worksheet.Cells[5, 2].GetStyle();

// Create a Font object
Font font = style.Font;

// Set the name.
font.Name = "Times New Roman";

// Set the font size.
font.Size = 18;

// Set the font color
font.Color = System.Drawing.Color.Blue;

// Bold the text
font.IsBold = true;

// Make it italic
font.IsItalic = true;

// Set the backgrond color of C6 Cell to Red
style.ForegroundColor = System.Drawing.Color.Red;
style.Pattern = BackgroundType.Solid;

// Apply the Style to C6 Cell.
cells[5, 2].SetStyle(style);

// Save the Workbook.
wbk.Save(dataDir + "mergingcells.out.xls");

Unmerging Cells

// Create a Workbook.
// Open the excel file.
Workbook wbk = new Aspose.Cells.Workbook(dataDir + "mergingcells.xls");

// Create a Worksheet and get the first sheet.
Worksheet worksheet = wbk.Worksheets[0];

// Create a Cells object ot fetch all the cells.
Cells cells = worksheet.Cells;

// Unmerge the cells.
cells.UnMerge(5, 2, 2, 3);

// Save the file.
wbk.Save(dataDir + "unmergingcells.out.xls"); 

You may refer to the following section for more details:
Merging and Unmerging Cells

You can get the free trial version here:
Aspose.Cells for .NET (Latest Version)

You can download the complete runnable solution for testing here.