TestClearRange.zip (512.4 KB)
I have attached the sample C# code that does not work for ClearFormats, The code also has the sample Test.xlsx file that is used within the code.
Context: We would want to remove all formatting outside of the working range i.e as sample file (A1:D28). We tried all the possible ways of SetStyle, but it was time and memory consuming. Finally ended up using the following code which works partially and does not work for all the cells in the range.
CellArea caRightSideOfTable = CellArea.CreateCellArea("E1", "XFD1048576"); sheet.Cells.ClearFormats(caRightSideOfTable); CellArea caBottomSideOfTable = CellArea.CreateCellArea("A29", "XFD1048576"); sheet.Cells.ClearFormats(caBottomSideOfTable);
Let me know if there is any method that works, also tried
ClearRange method too. Nothing works as expected. Please help