ExcelApplication.Open* vs. ExcelTemplate
* ExcelApplication.Open is not available in
ExcelWriterSE, ExcelWriterLE, or ExcelWriterFree.
ExcelWriter provides two means of using a preset spreadsheet format to
generate a new spreadsheet:
Using ExcelApplication.Open is slower than using ExcelTemplate because the
ExcelApplication object is larger and more complex than the ExcelTemplate object.
However, the ExcelApplication object is rich in features, and can modify
spreadsheets at runtime, while ExcelTemplate can only fill in cell values.
The following table summarizes the differences between the two.
Note: You can use ExcelTemplate and ExcelApplication
together, as demonstrated in
Passing ExcelApplication to ExcelTemplate and
Passing ExcelTemplate to ExcelApplication.
| | ExcelApp.Open | ExcelTemplate |
| Supported Excel formats |
BIFF7 (Excel 95) and BIFF8 (Excel 97/2000/XP).
Note: If you open a BIFF7 (Excel 95) format spreadsheet,
you cannot apply BIFF8 features to it. ExcelWriter will save the spreadsheet
in BIFF7 format. |
BIFF8 only. ExcelTemplate does not support BIFF7 format templates, and
will not generate BIFF7 format files. |
| Available in ExcelWriterSE/LE/Free |
No. |
Yes. |
| Modifications at runtime |
Yes. |
No. |
| Can populate template
data markers |
No. |
Yes. |
| Performance |
ExcelApplication's large object model makes it a slower
means of modifying an existing file than ExcelTemplate. |
Because it is compact, ExcelTemplate is a faster
means of populating a new spreadsheet with data from a
preformatted file than ExcelApp.Open. |
| Flexibility |
ExcelApplication is rich in features
which can be applied to an existing spreadsheet at runtime. |
ExcelTemplate only fills in cell values
at runtime (the data sources for the cell values
can include database records, variables, and arrays). |
| Data Sources |
ADO RecordSet
ADO.NET DataTable
ADO.NET DataSet
OleDBDataReader
SqlDataReader
1 and 2-dimensional arrays
Variables
|
ADO RecordSet
ADO.NET DataTable
ADO.NET DataSet
OleDBDataReader
SqlDataReader
1 and 2-dimensional arrays
Variables
|
| Requires modification of an existing Excel spreadsheet before opening. |
No. |
Yes. To use an existing Excel spreadsheet as a template, you must
add data markers
to it. |
| Supports Macros and VBA |
ExcelApplication preserves existing Macros and VBA
but cannot create new Macros and VBA. |
ExcelTemplate preserves existing Macros and VBA
but cannot create new Macros and VBA. |
Copyright © 2005, SoftArtisans, Inc.