Index of ASP Samples



Basic Samples

ArrayVars

This sample demonstrates how to use a one-dimensional array with multiple values as a data source.

ASP/Basic/ArrayVars/ArrayVars.asp

[View Source]
DataSourceUpdate

You can call Process and Save multiple times for the same instance of WordTemplate. The DataSourceUpdate sample generates two files with different data from a single template. After the first file is created, the data source is updated, and Process and Save are called a second time.

ASP/Basic/DataSourceUpdate/DataSourceUpdate.asp

[View Source]
OpenInline

WordWriter allows you save the generated Word file on the server, or stream it to the client. The following sample streams the generated file to the client with the file's content-disposition set to "inline." If the user chooses to open (rather than save) the file, it will open within the browser window.

ASP/Basic/OpenInline/OpenInline.asp

[View Source]
RecordSet

The RecordSet sample demonstrates how to use an ADO RecordSet as a template data source.

ASP/Basic/RecordSet/RecordSet.asp

[View Source]
SaveMultiple

You can call the Save method more than once to save a generated document to more than one location. This sample shows you how to save a copy of the document on the server and stream a copy to the client in one script.

ASP/Basic/SaveMultiple/SaveMultiple.asp

[View Source]
SaveToDisk

WordWriter allows you save the generated Word file on the server, or stream it to the client. The following sample saves the generated file on the server.

ASP/Basic/SaveToDisk/SaveToDisk.asp

[View Source]
StringVar

The StringVar sample generates a file from a template that contains a single merge field. The data source is a single-element array.

ASP/Basic/StringVar/StringVar.asp

[View Source]

Top


Intermediate Samples

DatabaseSelect

The DatabaseSelect sample creates a dynamic form letter, using a database as the template's data source.

ASP/Intermediate/DatabaseSelect/DatabaseSelectForm.asp

[View Form Source] [View Response Source]
Envelope

The Envelope sample uses WordWriter to generate an envelope. The template envelope contains merge fields for the delivery name and address and the return name and address. The WordWriter code uses an array as the data source and gets the array values from a Web form. To the sample, click Run Sample, enter return and delivery information in the form, and click the Generate button.

ASP/Intermediate/Envelope/EnvelopeForm.asp

[View Form Source] [View Response Source]
FaxCover

The FaxCover sample uses WordWriter to open a fax cover template, set a data source, populate the merge fields, and generate a new fax cover document. The template contains the merge fields ToName, FromName, FaxNumber, PhoneNumber, Subject, PageCount, Comments, chkUrgent, chkReview, and chkComment. The WordWriter code uses an array as the data source and gets the array values from a Web form.

Check boxes in the form provide the values for chkUrgent, chkReview, and chkComment. If a box is checked, "X" will be entered in the data source value array and displayed in the generated file. If a box is not checked, an empty string will be entered in the value array and nothing will be displayed by the field name (for example, by "Urgent") in the generated file. To run the sample, click Run Sample, enter the fax information in the form, and click the Generate button.

ASP/Intermediate/FaxCover/FaxCoverForm.asp

[View Form Source] [View Response Source]
Formatting

In Microsoft Word, you can apply special formatting to a template's merge fields. The following example generates a Word file from a template that contains merge fields with date and currency formatting. To see (or hide) a merge field's formatting codes, right-click the merge field and select Toggle Field Codes.

ASP/Intermediate/Formatting/Formatting.asp

[View Source]
FormLetter

The FormLetter sample uses WordWriter to open a template form letter, set a data source, populate the merge fields, and generate a new file. The template form letter contains merge fields for recipient name and address and author name and title. The WordWriter code uses an array as the data source and gets the array values from a Web form. To run either sample, click Run Sample, enter recipient and author information in the form, and click the Generate button.

ASP/Intermediate/FormLetter/FormLetterForm.asp

[View Form Source] [View Response Source]

Top


Copyright © 2003, SoftArtisans, Inc.