Free Support Forum - aspose.com

Trying to clear formatting when inserting rows

Hi,

I am trying to insert row with

workBook.Worksheets[0].Cells.InsertRows(workbookMaxRow - 1, 2);

but this is inserting rows with borders bcs this row having borders, so I want to clear formatting.

Pls help

Thanks,

Mukund

Hi Mukund,


Please use below lines of code to insert a row and remove it’s formatting. You may be using an old version of API. Use this code with latest fix version of Aspose.Cells for .NET v5.3.3.1[attached]. Also attached are my sample input output files in an archive.

C# Code

Workbook wb = new Workbook(“C:\temp\formattedrows_andimport.xlsx”);

wb.Worksheets[0].Cells.InsertRow(6); //Insert row between 6 and 7

wb.Worksheets[0].Cells.ClearFormats(6, 0, 6, 7); //Clear format of newly inserted row

wb.Save(“C:\temp\out.xlsx”);