We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to combine cells?

Is there any way to combine cells? say I want to combe cells[1,0] to cells[1,3].Thanks

Please try:

Excel excel = new Excel();
excel.Worksheets[0].Cells.Merge(1, 0, 1, 4);

Aspose.Cells has replaced Aspose.Excel which is no more continued now and is discarded. Aspose.Cells has much advanced features as compared to its predecessor as well as supports the latest features in MS Excel. You can combine cells using this product as well as shown in the following sample code:

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)

// 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");

Refer to the following article for more details on exporting data from worksheet:
Merging and unmerging cells

Give a try to this new product by downloading the latest free trial version here:
Aspose.Cells for .NET(Latest version)

You may download a runnable solution here for detailed testing of this new product.