...
Code Block |
---|
ExcelApplication XLAToXLA = new ExcelApplication(); |
...
Code Block |
---|
Workbook wbTo = XLAToXLA.Open(XLTTo); |
3. Access the first Worksheet.
...
Code Block |
---|
wsTo.PopulatedCells.AutoFitWidth(); wsTo.PopulatedCells.AutoFitWidth(); |
5. Instantiate the ExcelApplication object for the Worksheet to be copied from:
Code Block |
---|
ExcelApplication XLAFrom = new ExcelApplication();
|
6. Open the populated template file with ExcelApplication. One instance of ExcelApplication can be used to open multiple Workbooks
Code Block |
---|
Workbook wbFrom = XLAFromXLA.Open(XLTFrom); |
76. Open both the table sheet and the data sheet.
Code Block |
---|
Worksheet wsFrom = wbFrom[0]; Worksheet wsFromData = wbFrom[1]; Worksheet wsFrom = wbFrom[0]; Worksheet wsFromData = wbFrom[1] |
87. Call CopySheet with wbTo, and pass the worksheets. Make sure to copy the data sheet first
...
Code Block |
---|
wbTo.Worksheets.CopySheet(wsFromData, 1, "Data"); wbTo.Worksheets.CopySheet(wsFrom, 1, "Percent by Quarter"); |
98. Finally, call ExcelApplication.Save to save the final file. This example streams the file using the page response.
...