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

Object Model ExcelApplication ExcelTemplate Worksheets Worksheet Cells Cell Range Style Font Charts
Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area Pictures Picture PageSetup


The Cell Object (SACell)

Use Cell to create a Cell object. A Cell object represents a single cell. The following example demonstrates setting a Cell object, and assigning a value to it.

set cellB26 = ws.cells("B26")
cellB26.value = "Product"

Cell Methods and Properties

*This feature is not available in ExcelWriterSE, ExcelWriterLE, and ExcelWriterFree.

Cell Methods and Properties
ClearContents*  V4

The ClearContents method deletes any value or formula within the specified cell. The following example opens the spreadsheet clearcell.xls, and deletes the content of cells B4:B8.

features/clearcell.asp

[View Source]

Top

Col

Returns the column number of a specified cell. The following example demonstrates setting a cell object, and retrieving its column number.

set cell = ws.cells("B26")
CellColumn = cell.col
	

Top

Format

Use Format to create a look for a single cell. Both Format and Style define the appearance of cells. However, Style is used to define the look of a set of cells, while Format defines the look of an individual cell.

Define a format for a single cell, rather than create a style, only if it is unlikely that you will apply the same format to other cells. Whenever you define a format for an individual cell, you add format information to the spreadsheet, so if you define the same format repeatedly, the resulting spreadsheet file will be unnecessarily large. When you apply a single Style object to several cells, the style information is written to the spreadsheet only once, conserving space.

The properties of Format are, Font, Hidden, HorizontalAlignment, Locked, Number, Orientation, VerticalAlignment, and WrapText. For definitions of each of these properties, see Style. The following example demonstrates defining a format for a cell.

ws.Cells("E6").Format.Font.Name = "Times New Roman"
ws.Cells("E6").Format.Font.Color = 255   '--- RGB Value
ws.Cells("E6").Format.Orientation = saoriClockWise
	

Top

Formula

Use Formula to add Microsoft Excel formulas to your spreadsheet. For a complete list of available formulas see Formula Functions.

When applying a formula to a cell, always use an equal sign (=), as you would when creating an Excel spreadsheet. The following example demonstrates using a formula.

ws.Cells("b6").Formula = "=sum(b2:b3)"
	

Top

Name

Returns the specified cell's name. A cell name includes its column letter and row number, for example B5. To retrieve the name of a cell, use,

cell.name
	

Top

PutValue

Puts a value in a cell.

	cell.PutValue("Grand Total")
	
is equivalent to,
cell.value = "Grand Total"
	

Top

Row

Return the row number of a specified cell. The following example demonstrates setting a cell object, and retrieving its row number.

set cell = ws.cells("B26")
CellRow = cell.row
	

Top

Style

Use Style to apply a defined Style object to a cell. Both Format and Style define the look of cells, but a format is created for a single cell, while a style is defined for reuse.

Define a format for a single cell, rather than create a style, only if it is unlikely that you will apply the same format to other cells. Whenever you define a format for an individual cell, you add format information to the spreadsheet, so if you define the same format repeatedly, the resulting spreadsheet file will be unnecessarily large. When you apply a single Style object to several cells, the style information is written to the spreadsheet only once, conserving space.

To define a style, first set a Style object, and assign values to any or all of its properties, for example,

Set mystyle = xlw.CreateStyle
mystyle.Font.Name = "Arial"
mystyle.Font.Bold = True
mystyle.HorizontalAlignment = sahaRight
	

Then, assign your style to individual cells, for example,

ws.cells("A1").style = mystyle
	

Top

Value

Use Value to assign a value to a cell.

cell.value = "Grand Total"
	
is equivalent to,
cell.PutValue("Grand Total")
	

Top

*This feature is not available in ExcelWriterSE, ExcelWriterLE, and ExcelWriterFree.


Object Model ExcelApplication ExcelTemplate Worksheets Worksheet Cells Cell Range Style Font Charts
Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area Pictures Picture PageSetup


Copyright © 2003, SoftArtisans, Inc.