...
Vbnet | ||||
---|---|---|---|---|
| ||||
Dim XLAPP As New ExcelApplication() |
Unlike the ExcelTemplate
object, which represents a single file, the ExcelApplication
works as a file generation engine. The ExcelApplication
object can be used to create, open, and save multiple workbooks.
3. Create a new workbook with ExcelApplication.Create()
Csharp | ||||
---|---|---|---|---|
| ||||
Workbook WB = XLAPP.Create(ExcelApplication.FileFormat.Excel2007); |
...
Vbnet | ||||
---|---|---|---|---|
| ||||
XLAPP.Save(WB, Page.Response, "Output.xlsx", False) |
ExcelApplication.Save
has the same output options as ExcelTemplate
: save to disk, save to memory stream, stream back to the client inline, and stream back to the client as an attachment. In this case, we're streaming the workbook back to the client as an attachment.
Remember that the file extension must match the file format specified when the workbook was created.
...