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

Free Support Forum - aspose.com

Insert and Copy Cell

Hi there, I’m a little stuck on something and could use some help please.

Given a source cell, I’d like to be able to insert another cell to the right, and copy over everything from the source cell.

Basically, I want something like the functionality of InsertColumn and CopyColumn but without inserting an entire column, just a cell to the right. My experiments with InsertRange and Cell.Copy don’t seem to be working.

 CellArea ca = new CellArea();
ca.StartColumn = Cell.Column;
ca.EndColumn = Cell.Column + 1;
ca.StartRow = Cell.Row;
ca.EndRow = Cell.Row;

Cell.Worksheet.Cells.InsertRange(ca, ShiftType.Right);
Cell.Copy(Cell.Worksheet.Cells[Cell.Row, Cell.Column + 1]);

Hope that makes sense…


Please create your input and output xlsx files with your desired results manually using Ms-Excel and post here. It will help us to know your requirements better and we will be able to provide you a code example.