Table of Contents |
---|
Description
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.
Remarks
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:
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:
Examples
Properties
Name |
Description |
---|---|
Returns a boolean that represents whether or not WordWriter will write all text using unicode. A value of false can result in smaller file sizes but text that is not part of cp1252 (Windows-1252) will be unreadable. This is set to true by default. It is recommended that you should set this to false if it is known that only characters supported by Windows-1252 are in the document, especially when creating large documents. |
|
Sets or returns the license key used for this instance of WordApplication. This property is mainly used for debugging purposes. For managing your license keys, please use the License Key Manager that is installed with OfficeWriter. | |
Sets or returns a boolean that represents whether or not WordWriter will preserve feature of an existing document that it does not natively support. Setting this to false can result in smaller file sizes, but features that are not natively supported by WordWriter will be stripped out. This is set to true by default. | |
Returns the exact version of WordWriter. The format of the version string returned is: |
Methods
Name |
Description |
---|---|
Creates and returns a new Document based on the Normal style. | |
Opens and returns an existing Document from disk. | |
Opens and returns an existing Document from the specified Stream. | |
Takes a WordTemplate object representing a template Word file, and opens the file as a Document object. | |
Writes a Document to a file. | |
Writes a Document to a stream in the form of a Microsoft Word document. | |
Streams a Document to an HttpResponse with the option of having it open in the user's web browser. The fileName specified will appear in the browser window. In addition, the content-type to use when streaming the file is specified. | |
Save(Document, System.Web.HttpResponse, String, Boolean, String) |
Streams a Document to an HttpResponse with the option of having it open in the user's web browser. The fileName specified will appear in the browser window. In addition, the content-type to use when streaming the file is specified. |
Creates a new WordApplication object |
Extension Methods
Overload |
Description |
---|---|
Opens and returns an existing Document from a SharePoint Document Library. | |
Opens and returns an existing Document from a SharePoint List Item. | |
Save(Document, Microsoft.SharePoint.SPDocumentLibrary, String, Boolean) |
Writes a Document to a file and saves it to a SharePoint Document Library. |
Writes a Document to a file and saves it to a SharePoint List Item. |