I'm using the C# EPPlus library to create Excel documents.
ExcelWorksheet ws = pkg.Workbook.Worksheets.Add("Sheet1");
ws.Cells["E3"].Value = "Foo";
ws.Cells["F3"].Value = "Bar";
ws.Cells["F3"].Style.Font.Bold = true;
The ws.Cells[]
return type is ExcelRange which has a Dispose() method.
Do I need to call it each time I use ws.Cells[]
?
Something like
ExcelWorksheet ws = pkg.Workbook.Worksheets.Add("Sheet1");
ExcelRange rng;
rng = ws.Cells["E3"];
rng.Value = "Foo";
rng.Dispose();
using (rng = ws.Cells["F3"])
{
rng.Value = "Bar";
rng.Style.Font.Bold = true;
}
would be a heavy syntax !
Is it really necessary ?