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

Formatting Headers and Footers


Formatting Headers and Footers in an ExcelWriter Script*

* ExcelWriter's header and footer properties are not available in ExcelWriterSE, ExcelWriterLE, and ExcelWriterFree.

ExcelWriter allows you to create and format headers and footers for your spreadsheet in script using the the PageSetup object properties LeftFooter, CenterFooter, RightFooter, LeftHeader, CenterHeader, and RightHeader. Note: The PageSetup properties are not available in ExcelWriterLE.

The following example demonstrates formatting headers and footers in an ExcelWriter script. The generated spreadsheet will open in the browser. To see the headers and footers, open the File menu, select Page Setup, and select the Header/Footer tab.

features/FormatHeaderFooter.asp

[View Source]

To format a header or footer in script, include formatting codes within the ExcelWriter header/footer property. For example, the following displays the center header text in bold Tahoma:

	ws.PageSetUp.CenterHeader = "&""Tahoma""&BFormatting Headers and Footers&B"
Formatting Codes for Headers and Footers
&LLeft aligns the characters that follow.
&CCenters the characters that follow.
&RRight aligns the characters that follow.
&ETurns double-underline on or off.
&XTurns superscript on or off.
&YTurns subscript on or off.
&BTurns bold on or off.
&ITurns italic on or off.
&UTurns underline on or off.
&STurns strikethrough on or off.
&DPrints the current date.
&TPrints the current time.
&FPrints the name of the document.
&APrints the name of the worksheet.
&PPrints the page number.
&P+numberPrints the page number plus the specified number.
&P-numberPrints the page number minus the specified number.
&&Prints a single ampersand.
&"font name"Prints the characters that follow in the specified font size.

Important: In ASP, the font name must be within double quotation marks, as in the following example,
ws.PageSetUp.CenterHeader = "&""Tahoma""&Center Header"
&nnPrints the characters that follow in the specified font size. Use a two digit number to specify a size in points.
&NPrints the total number of pages in the document.

Top


Formatting Headers and Footers in Microsoft Excel

When opening an existing Excel spreadsheet, ExcelWriter will preserve the header and footer formatting created in Excel. However, if you change the header/footer text in your ExcelWriter script and do not include Formatting Codes, the formatting created in Excel will be overwritten, and default formatting applied. To preserve header/footer formatting created in Excel, do not change header/footer text in script. Alternatively, format headers and footers in script.

To format spreadsheet headers and footers in Excel and preserve the formatting in ExcelWriter:

  1. In Microsoft Excel, open the File menu and select Page Setup...


  2. Select the Header/Footer tab.


  3. Select a header and/or footer from the drop-down list.



    Or, create a custom header/footer.



  4. Save the spreadsheet.


  5. In an ExcelWriter script, open the spreadsheet containing headers/footers. Use either ExcelTemplate or ExcelApplication.Open* to open the spreadsheet.


  6. Modify the spreadsheet in script. Do not change the text of headers and footers; if you do, the original formatting will be overwritten, and default formatting applied.
* ExcelApplication.Open is not available in ExcelWriterSE, ExcelWriterLE, and ExcelWriterFree.

Top


Copyright © 2003, SoftArtisans, Inc.