Hi,
Can you please provide a bit info on the Worksheet.Cells.CreateRange method. Any documentation will be very helpful
Thanks.
Hemangajit
Hi,
Can you please provide a bit info on the Worksheet.Cells.CreateRange method. Any documentation will be very helpful
Thanks.
Hemangajit
Please check the doc topic for your reference:
For your further reference, I have pasted a sample code here, check it out.
Sample code:
//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet in the book.
Worksheet WS = workbook.Worksheets[0];
//Create a range of cells i.e.., L3:V4
Range range = WS.Cells.CreateRange(2, 11, 2, 11);
//Name the range.
range.Name = "MyRange";
//Declare a style object.
Style stl;
//Create the style object with respect to the style of the first row.
stl = WS.Cells.Rows[0].Style;
//To Set the fill color of the range, you may use ForegroundColor with
stl.ForegroundColor = System.Drawing.Color.Yellow;
stl.Pattern = BackgroundType.Solid;
//Apply the style to the range.
range.Style = stl;
//Save the excel file.
workbook.Save("f:\\test\\Ranges.xls");
Thank you.