When I try to apply black color to all cells except first cell my application throws an error of System.OutOfMemoryException,
It creates a huge file.
//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet in the book.
Worksheet worksheet = workbook.Worksheets[0];
//This works good-Creates file with size of 7kb
//worksheet.Cells.ApplyStyle(new Style() { BackgroundColor = Color.Black, Pattern = BackgroundType.Solid, ForegroundColor = Color.Black }, new StyleFlag() { All = true });
//This takes time and throws an exception - SystemOutOfMemory
Range r = worksheet.Cells.CreateRange(1, 1, 1048575, 16383);
r.ApplyStyle(new Style() { BackgroundColor = Color.Black, Pattern = BackgroundType.Solid, ForegroundColor = Color.Black }, new StyleFlag() { All = true });
//Save the excel file.
workbook.Save("D:\\output.xlsx");
Is there any other fast and good way to do this?