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 Font Object (SAFont)

Use CreateFont to set a Font object. The Font object represents a font style that you can use when creating a reusable Style object, or a single-cell Format. To define a font, first set the CreateFont object, then assign values to any or all of its properties, for example,

	Set myfont = xlw.CreateFont
	myfont.name = "Arial"
	myfont.size = 10
	myfont.color = rgb(100,100,0)
	

Font Methods and Properties

Font Methods and Properties
Bold

When set to True, displays text in bold.

'--- Set Bold to True for the format of a single cell
ws.cells("A1").format.font.bold = true
	
'--- Set Bold to True for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.bold = true
	

Top

Charset*

Sets or returns the character encoding set of a given cell's font. The following example demonstrates setting cell B25's character set to the symbol set.

ws.cells("B25").format.font.charset = 2  '--- Symbol set
	

Top

Color

Defines the font color for the format of a single cell, or for a reusable Style object. Use RGB codes to assign color values.

'--- Set Color to RGB 255 (red) for the format of a single cell
ws.cells("A1").format.font.color = 255
	
'--- Set Color to RGB 255 (red) for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.color = 255
	

Top

Italic

When set to True, displays text in italic.

'--- Set Italic to True for the format of a single cell
ws.cells("A1").format.font.italic = true
	
'--- Set Italic to True for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.italic = true
	

Top

Name

Use the Name property to assign a font (Arial, Courier, etc.) to your format or style.

'--- Set the font to Times New Roman for the format of a single cell 
ws.cells("A1").format.font.name = "Times New Roman"
	
'--- Set the font to Times New Roman for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.name = "Times New Roman"
	

Top

QueryFontDisp*

Returns the name of the font displayed in a specified cell.

'--- Display the font name assigned to the format of a single cell
ws.cells("B5").value =  ws.cells("A5").format.font.QueryFontDisp
	
'--- Display the font name assigned to a reusable Style object
ws.cells("A14").value = mystyle.font.queryfontdisp
	

Top

Size

Defines font size.

'--- Set font size to 8 pt. for the format of a single cell
ws.cells("A1").format.font.size = 8

'--- Set font size to 8 pt. for a reusable Style object
mystyle.font.size = 8
	

Top

Strikethrough*

When set to True, displays text in strikethrough format.

'--- Set Strikethrough to True for the format of a single cell
ws.cells("A1").format.font.strikethrough = true
	
'--- Set Strikethrough to True for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.strikethrough = true
	

Top

Subscript*

When set to True, displays text in subscript format.

'--- Set Subscript to True for the format of a single cell
ws.cells("A1").format.font.subscript = true
	
'--- Set Subscript to True for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.subscript = true
	

Top

Superscript*

When set to True, displays text in superscript format.

'--- Set Superscript to True for the format of a single cell
ws.cells("A1").format.font.superscript = true
	
'--- Set Superscript to True for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.superscript = true
	

Top

Underline*

Sets or returns an underline style for a specified cell, or for a style. Set Underline to any of the following styles, using either the style's name or number.

Style NameStyle NumberComments
TruePreserved for backward compatability.
Equivalent to saxlUnderline.
FalsePreserved for backward compatability.
Equivalent to saxlNoUnderline.
saxlUnderline-1Equivalent to True.
saxlNoUnderline0Equivalent to False.
saxlSingleUnderline1For C++. Equivalent to True.
saxlDoubleUnderline2
saxlAccountingUnderline3
saxlDoubleAccountingUnderline   4
'--- Set Underline to saxlAccountingUnderline for the format of a single cell
ws.cells("A1").format.font.underline = saxlAccountingUnderline
	
'--- Set Underline to saxlDoubleUnderline for a reusable style object
Set mystyle = xlw.CreateStyle
mystyle.font.underline = saxlDoubleUnderline
	

Top

Weight*

Use Weight to set a font to bold. The default value of Weight is 400 (plain text). To display text in bold, set Weight to 700, as follows,

ws.cells("A38").format.font.weight = 700
	

Top

*This feature is not available in ExcelWriterSE, ExcelWriterLE, or 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.