WordTemplate Class open setLocale setDataSource process save

The WordTemplate Class


java.lang.Object
  |
  +--com.softartisans.wordwriter.WordTemplate

Description

public class WordTemplate
extends java.lang.Object

The WordTemplate class represents a WordWriter template. A WordWriter template is a file created in Microsoft Word that contains merge fields. A merge field displays a data source field name (for example, a database column name) where a data source value will be inserted. The WordTemplate class provides methods that open the template, set a data source, populate merge fields, and generate a new Word file.

The WordTemplate class is in com.softartisans.wordwriter. To create an instance of WordTemplate:

  1. Import the WordTemplate class to your Java page:
    import com.softartisans.wordwriter.WordTemplate;
  2. Declare the WordTemplate object and intialize it as null:
    WordTemplate oWW = null;
  3. Create an instance of WordTemplate:
    oWW = new WordTemplate();

Constructor

public WordTemplate()

Creates a new WordTemplate object.


WordTemplate Methods

open

The open method opens a WordWriter template.

setLocale The setLocale method allows you to override the server's default locale when generating a new Word file.
setDataSource

The setDataSource method sets a data source to bind to the merge fields in a WordWriter template file. The data source may be a SQL resultset or a one-dimensional array.

process

The process method enters data source values in a template's merge fields.

save

The save method either saves the generated Word file on the server or streams it to the browser.


WordTemplate Class open setLocale setDataSource process save

Copyright © 2003, SoftArtisans, Inc.