Free Support Forum -

Column not getting inserted


I need to insert a column at the 1st position just before I save the excel. I have used the Cells.Insertcolumn method earlier for this , it used to work, now its not inserting. The code that I have is as given below. Can you tell me if there is anything wrong with it ? how can I get to insert a column?

Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

worksheet.Name = "test";

Cells cells;

cells = worksheet.Cells;

FileStream fs = File.OpenRead("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg");

byte[] array = new byte[fs.Length];

fs.Read(array, 0, array.Length);

MemoryStream stream = new MemoryStream(array);

worksheet.Pictures.Add(0, 0, 6, 6, stream);

int currRow = 9;

cells[currRow, 2].PutValue(" Confidentiality: Private");

cells[currRow, 2].Characters(0, 18).Font.Color = workbook.GetMatchingColor(System.Drawing.ColorTranslator.FromHtml("#B9A06A"));

cells[currRow, 2].Characters(18, 26).Font.IsBold = true;

for (int i = 1; i <= 9; i++)


cells[currRow, i].Style.ForegroundColor = System.Drawing.ColorTranslator.FromHtml("#FFFF99");

cells[currRow, i].Style.Pattern = BackgroundType.Solid;


currRow += 1;


workbook.Save("testCustomheaders.xls", FileFormatType.Default, SaveType.OpenInBrowser, this.Response);



Hi Soumya,

Thanks for considering Aspose.

We will check and sort out your problem soon.

Thanks for your patience.


Amjad Sahi

Aspose Nanjing Team

Hi Soumya,

Do you mean that the picture is not shifted after calling InsertColumn method? Please try this attached fix.