Background In this code-snippet, we discussed about
We have the requirements to generate/create Excel Spreadsheet using dynamic data on the fly. There are lot of open sources and freewares available including ICEBlue, EPPS, Excelgenerator. In our example, we will use free spire.xls from ICEBlue to create/meet our requirements.
What we need to do?
No, any special activities required you just need to include a dll (Dynamic Lnk Library) in your project and you're ready to start the work. Here is the code, which will create spreadsheet, there are lot of feature, I am not going to discuss here.
public class SampleExcel
private string _xlsFilePath = HttpContext.Current.Server.MapPath("~/Sample/XLSFiles/");
private string _xlsFileName;
private Workbook workBook;
private Worksheet workSheet;
public SampleExcel(string xlsFileName)
_xlsFileName = xlsFileName;
workBook = new Workbook();
public void CreateSampleExcel()
workSheet = workBook.Worksheets;
workSheet.Range["A1"].Text = "This is a sample Excel dcouemnt and created on the fly using C#";
workBook.SaveToFile(_xlsFilePath + _xlsFileName);
how we can create Microsoft Excel sheet or spreadsheet on the fly using dynamic data.
Copy/paste above code and enjoy the taste of this great tool.
In this code-snippet, we discussed about