Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.6.1
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > WordApplication API > WordApplication

The WordApplication Object


WordApplication is the main class for pure code-based Word document generation (for information about template-based workbook generation, see WordTemplate ). This class is an engine used to open, create, and write (save to disk or stream to a browser) Word documents. A single instance of WordApplication can generate multiple documents.

A generated document is represented by the Document class.

The WordApplication class is in the SoftArtisans.OfficeWriter.WordWriter namespace. The class can can be referenced as SoftArtisans.OfficeWriter.WordWriter. To minimize typing and errors, import the namespace to the aspx page, and reference the class as WordApplication, without the namespace prefix. If you are coding directly in the .aspx page, following the Page directive, include:

<%@Import Namespace="SoftArtisans.OfficeWriter.WordWriter"%>

If you are coding in the code-behind page (.aspx.cs or .aspx.vb), include a using or Imports statement at the top of the code behind page:

C#: using SoftArtisans.OfficeWriter.WordWriter;

VB.NET: Imports SoftArtisans.OfficeWriter.WordWriter



Examples:

[csharp]
// Create an instance of the WordApplication class
WordApplication oWordApplication = new WordApplication();
[vbnet]
' Create an instance of the WordApplication class
Dim oWordApplication As New WordApplication()


WordApplication Properties

Property Type Access Description
LicenseKey String read
write

Sets or returns the license key used for this instance of WordApplication

Preserve boolean read
write

Sets or returns a boolean that represents whether or not WordWriter will preserve feature of an existing document that it does not natively support

Version String read

Returns the exact version of WordWriter



WordApplication Methods

ReturnsSignature and Description
Document Create ( )

Creates and returns a new Document based on the Normal style

Document Open ( String fileName )

Opens and returns an existing Document from disk.

Document Open ( System.IO.Stream stream )

Opens and returns an existing Document from the specified Stream.

Document Open ( WordTemplate wwt )
Takes a WordTemplate object representing a template Word file, and opens the file as a Document object.
void Save ( Document doc , String fileName )

Writes a Document to a file

void Save ( Document doc , System.IO.Stream out )

Writes a Document to a stream in the form of a Microsoft Word document

void Save ( Document doc , System.Web.HttpResponse response , String fileName , boolean openInBrowser )

Streams a Document to an HttpResponse with the option of having it open in the user's web browser

void Save ( Document doc , System.Web.HttpResponse response , String fileName , boolean openInBrowser , String contentType )

Streams a Document to an HttpResponse with the option of having it open in the user's web browser



Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.