Introduction
  Welcome
  The Web Reporting Solution
  What is ExcelWriter?
  Features and Benefits
  New in This Version  V4
  Requirements
  Edition Differences
  Frequently Asked Questions
  Troubleshooting

Quick Start
  Creating Your First Spreadsheet
  Adding a Formula
  Adding Formatting
  Importing from a Database

Features In Depth
  Addressing Cells
  Setting Values
  Output Options
  Adding Charts
  Reading an Existing Spreadsheet
  Modifying an Existing Spreadsheet
  The Range Object
  Template Spreadsheets
  How to Use Templates
  ExcelApp.Open vs. ExcelTemplate
  Using ExcelTemplate with PivotTables
  Templates and Charts
  Reliable Spreadsheet Download  V4
  Page Setup
  Formatting Headers & Footers
  Protecting your Worksheet
  Multilingual Support  V4
  XML Import

HotCell Technology  V4
  What is HotCell Technology?
  Upload Example
  Advanced POST Example
  Advanced Upload Example

Programmer's Reference
  Object Model
      ExcelTemplate Object
      ExcelApplication Object
         3DProperties Object
         Area Object
         Axis Object
         Cells Object
         Cell Object
         Charts Object
         Chart Object
         ChartFrame Object
         Font Object
         Line Object
         PageSetup Object
         Pictures Object
         Picture Object
         Range Object
         SeriesCollection Object
         Series Object
         Style Object
         Worksheets Object
         Worksheet Object
  Formula Functions
  Formula Calculation Operators
  Formatting Codes
  Chart Codes

Installation
  Quick Installation
  Configuring IIS
  Security Considerations

External Links
  ExcelWriter Home Page
  Technical Support
  ExcelWriter Demos
  SoftArtisans Home Page
  E-mail General Questions
  E-mail Technical Support
  Legal Information

Output Options


Output Options with ExcelApplication: The Save Method

ExcelWriter can write spreadsheets in a number of different ways. You may choose to save a generated spreadsheet to the server's hard disk, return the file in memory, or open the file in either the browser or Microsoft Excel. Both and ExcelTemplate provide several options for writing the generated spreadsheet.

Using the ExcelApplication object's Save method, you can,

  • Save a spreadsheet to disk.

  • Return the spreadsheet as a BinaryStream, that is, as a sequence of bytes in memory. (Technically, this is a variant of type VT_UI1 | VT_ARRAY.)

  • Open the spreadsheet in Excel.

  • Open the spreadsheet in the browser. In this case, Internet Explorer's menus and toolbars will be replaced with Excel's.

  • V4  Return the spreadsheet as an ExcelTemplate object. *This feature is not available in ExcelWriterSE and ExcelWriterLE.

ExcelApplication's Save method takes three optional parameters:

[varBytes =] objExcelApplication.Save [FileName], [SaveMethod], [SaveFormat]
ExcelApplication.Save Parameters

FileName Optional. If saving to disk, assign the path and file name of the new spreadsheet. If opening the file, assign a file name only. To return the file in memory, do not assign a value to this parameter.
SaveMethod

Optional. Specifies whether to save the file to disk, open it in Excel, open it in the browser, return it in memory, or return it as an ExcelTemplate object.

0saDefaultIf a FileName is assigned, the file will be saved to disk.

If a FileName is not assigned, the file will be returned in memory as a sequence of bytes.
1saOpenInExcelOpen the file in Excel
2saOpenInPlaceOpen in the browser
3saOpenAsTemplateReturn an ExcelTemplate object.

*This feature is not available in ExcelWriterSE and ExcelWriterLE.

Note: To use ExcelWriter constants (e.g., saOpenInExcel), include ExcelWriter's TypeLib metadata tag at the beginning of your script:

<!--METADATA TYPE="TypeLib" UUID="{7BCD2133-64A0-4770-843C-090637114583}"-->

Default value: 0
SaveFormat

Optional. Specifies whether to save the spreadsheet in BIFF7 (Excel 95) or BIFF8 (Excel 97/2000) format.

7 in V1.x
8 in V2 or later
saFileFormatDefault
7saFileFormatExcel95
8saFileFormatExcel97
8saFileFormatExcel2000

Note: To use ExcelWriter constants (e.g., saFileFormatExcel95), include ExcelWriter's TypeLib metadata tag at the beginning of your script:

<!--METADATA TYPE="TypeLib" UUID="{7BCD2133-64A0-4770-843C-090637114583}"-->

Default value: 7 in V1.x, 8 in V2

ExcelApplication.Save Examples

Filename SaveMethod SaveFormat Result Example
Null saDefault
(=0)
saDefault
(=0)
Return the spreadsheet as a sequence of bytes to varBytes.
varBytes = xlw.Save
Path and file name saDefault
(=0)
saFileFormatExcel95
(= 7)
Save the file in Excel95 (BIFF7) format to a specific location on the hard disk.
xlw.Save "d:\reports\report1.xls",,_
		saFileFormatExcel95
File name only, no path saOpenInExcel
(=1)
saDefault
(=0)
Open in Excel on the client. If the user saves the file, it will have report.xls as the default name. If the file has already been cached by the browser, it will appear as report(1).xls.
xlw.Save "report.xls", saOpenInExcel
File name only, no path saOpenInPlace
(= 2)
saDefault
(=0)
Open in the browser window. If the user doesn't have MS-Excel support in IE, it will ask the user to save the file.
In this case, the Filename property isn't used, instead the browser will use the webserver script(which generates this Excel file) name as the default name.
xlw.Save "report.xls", saOpenInPlace

Top


Output Options with ExcelTemplate: The Process Method

ExcelWriter can write spreadsheets in a number of different ways. You may choose to save a generated spreadsheet to the server's hard disk, return the file in memory, or open the file in either the browser or Microsoft Excel. Both ExcelApplication and provide several options for writing the generated spreadsheet.

Using the ExcelTemplate object's Process method, you can,

  • Save a spreadsheet to disk.

  • Open the spreadsheet in Excel.

  • Open the spreadsheet in the browser. In this case, Internet Explorer's menus and toolbars will be replaced with Excel's.

  • Return the spreadsheet as an ExcelApplication object. The spreadsheet can then be modified using ExcelApplication's objects, methods, and properties. See Example 2: Using ExcelTemplate with ExcelApplication.

ExcelTemplate's Process method takes three parameters:

ExcelTemplate.Process Parameters

FileName Path and file name of the new spreadsheet
ProcessMethod

Optional. Specifies whether to save the file to disk, open it in Excel, open it in the browser, or return an ExcelApplication object. Assign ProcessMethod by name or number:

0saProcessDefaultSave the file to disk
1saProcessOpenInExcelOpen the file in Excel
2saProcessOpenInPlaceOpen in the browser
3saProcessOpenForScriptingReturn the file in memory as an ExcelApplication object. The spreadsheet can then be modified using ExcelApplication's objects, methods, and properties. See Example 2: Using ExcelTemplate with ExcelApplication.
Note: This value is not available in ExcelWriterSE and ExcelWriterLE.
Default value: 0
ExcludeMacro Optional. If set to True, macros in the template will be excluded from the generated spreadsheet.

When ExcludeMacro is enabled, buttons associated with macros may produce the error "Data may have been lost." Therefore, when excluding macros, remove all associated buttons from the spreadsheet.
Default value: False

Top


Copyright © 2003, SoftArtisans, Inc.