Description
The WordTemplate object represents a WordWriter template. A WordWriter template is a file created in Microsoft Word that contains merge fields.
Remarks
TheWordTemplate
object is in the SoftArtisans.OfficeWriter.WordWriter namespace. The object can be referenced as SoftArtisans.WordWriter.WordTemplate
. To minimize typing and errors, import the namespace to the aspx page, and reference the object as WordTemplate
, without the namespace prefix.
Examples
If you are coding directly in the .aspx page, following the Page directive, include:
If you are coding in the "code behind" page (.aspx.vb or .aspx.cs), include an Imports
or using
statement at the top of the "code behind" page:
To create an instance of the WordTemplate object use:
Fields
Used by SetDataSource to indicate that as much of the data source should be imported as possible. |
Properties
Name |
Description |
---|---|
Returns the names of all bookmarks in a WordWriter template. | |
Sets or returns the content-type header that will be sent to the browser with the generated Word document. | |
The CultureInfo property allows you to override the server's default locale when generating a new Word file. For example, to generate a US English document on a French operating system, you could use CultureInfo to set the Word file's
System.Globalization.CultureInfo to US English. |
|
Use DataSourceSeparator to set the character that separates a data source name from a column name in a data marker. '.' is the default data source separator. | |
Gets or sets whether NEXT fields should be enabled in the WordTemplate. If NEXT fields are enabled, the data source will move to the next row of data when merge field is repeated in the template file. | |
Returns the names of all merge fields in the main document. | |
Sets or returns the registered 23-character license key that enables WordWriter. | |
Gets or sets whether merge fields and next fields should be preserved after processing the WordTemplate. | |
The extension that should be used when saving this template; based on the input file. |
|
Gets or sets whether IF fields will be unlinked from the document after they are evaluated. | |
Gets or sets whether IF fields should be evaluated server-side in the WordTemplate. | |
Returns the exact version of WordWriter. |
Methods
Name |
Description |
---|---|
Returns the names of all merge fields in the specified bookmark. | |
Opens the WordWriter template specified by the templateFileName parameter. |
|
Opens a WordWriter template from a System.IO.Stream. A WordWriter template is a file created in Microsoft Word that contains merge fields. | |
Passes a document from WordApplication to WordTemplate. | |
The Process method enters data source values in a template's merge fields, and creates an image of the output file (the new document) in memory. | |
Saves the generated Word file on the server. | |
Sends the generated Word binary file to the specified
System.IO.Stream or, a class derived from System.IO.Stream (for example,
System.IO.FileStream). |
|
If you pass Save an HttpResponse object object, WordWriter will stream the generated file to the client. If the user chooses to open (rather than save) the file, it will open in the browser window. | |
If you pass save an HttpServletResponse object, WordWriter will stream the generated file to the client. This method allows you to specify a default client-side file name, and whether the file should be opened in the browser window or in Microsoft Word. |
|
Sets a main document data source to a one-dimensional object array. The method imports a single row of data to the specified set of main document merge fields. | |
Sets a main document data source to a one-dimensional object array. The method imports a single row of data to the specified set of main document merge fields. | |
Sets a main document data source to an ADO.NET DataSet. A DataSet contains a collection of DataTables. If you set a main document data source to a DataSet, WordWriter will get the first row of the first DataTable in the DataSet. | |
Sets a template's data source to an ADO.NET DataSet. A DataSet contains a collection of DataTables. If you set a template's data source to a DataSet, WordWriter will get the first row of the first DataTable in the DataSet. | |
Sets a main document data source to an ADO.NET DataTable. If the specified DataTable contains more than one row, WordWriter will use the first row as the data source. | |
Sets a template's data source to an ADO.NET DataTable. If the specified DataTable contains more than one row, WordWriter will use the first row as the data source. | |
Sets a main document data source to an an IDataReader interface, which may be either a SqlDataReader, OleDbDataReader, or an AdomdDataReader. If the specified DataReader returns more than one row, WordWriter will use the first row as the data source. | |
Sets a template's data source to an an IDataReader interface, which may be either a SqlDataReader, OleDbDataReader or an AdomdDataReader. If the specified DataReader returns more than one row, WordWriter will use the first row as the data source. | |
Sets the data source for the specified main document merge field to an object. The main document is the part of the document that is not within a repeat block. | |
Sets an IEnumerator collection as a data source to bind to a specified set of main document merge fields. | |
SetDataSource(System.Collections.IEnumerator, String(), String) |
Sets an IEnumerator collection as a data source to bind to a specified set of main document merge fields. |
Sets a template's main document data source to an
IDictionary collection. An IDictionary represents a collection of key-and-value pairs. |
|
Sets a template's main document data source to an
IDictionary collection. An IDictionary represents a collection of key-and-value pairs. |
|
Sets an ICollection as a data source to bind to a specified set of main document merge fields. | |
SetDataSource(System.Collections.ICollection, String(), String) |
Sets an ICollection collection as a data source to bind to a specified set of main document merge fields. |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. This should largely imitate the behavior of a Microsoft Word Mail merge. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. This should largely imitate the behavior of a Microsoft Word Mail merge. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. This should largely imitate the behavior of a Microsoft Word Mail merge. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. This should largely imitate the behavior of a Microsoft Word Mail merge. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. This should largely imitate the behavior of a Microsoft Word Mail merge. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the entire page as a repeat block, adding a new page when needed. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. This should largely imitate the behavior of a Microsoft Word Mail merge. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. This should largely imitate the behavior of a Microsoft Word Mail merge. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
Sets the MailMerge's data source to a DataTable. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
Sets the MailMerge's data source to a two-dimensional (rectangular) array of objects. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
Sets the specified repeat block's data source to an ADO.NET DataSet. A repeat block is a fragment in the template document that will be repeated for each row in a data source. In the template document, repeat blocks are defined by Word bookmarks that contain merge fields. | |
Sets the specified repeat block's data source to an ADO.NET DataSet. | |
Sets the specified repeat block's data source to an ADO.NET DataTable. | |
Sets the specified repeat block's data source to an ADO.NET DataTable. | |
Sets the specified repeat block's data source to an IDataReader interface, which may be either a SqlDataReader, OleDbDataReader or an AdomdDataReader. | |
Sets the specified repeat block's data source to an IDataReader interface, which may be either a SqlDataReader, OleDbDataReader, or an AdomdDataReader. | |
Sets the specified repeat block's data source to a 1-dimensional array of objects. | |
Sets the specified repeat block's data source to a multidimensional (rectangular) array of objects. | |
Sets the specified repeat block's data source to a multidimensional (rectangular) array of objects. | |
Sets the specified repeat block's data source to a jagged array (array-of-arrays) of objects. | |
SetRepeatBlock(Object()(), String(), String, Int32, Boolean) |
Sets the specified repeat block's data source to a jagged array (array-of-arrays) of objects. |
Sets the specified repeat block's data source to an IEnumerator collection. | |
SetRepeatBlock(System.Collections.IEnumerator, String, String) |
Sets the specified repeat block's data source to an IEnumerator collection. |
Sets the specified repeat block's data source to an ICollection. | |
SetRepeatBlock(System.Collections.ICollection, String, String) |
Sets the specified repeat block's data source to an ICollection. |
Creates a new WordTemplate object. |
Extension Methods
Introduced in build 4.5
Overload |
Description |
---|---|
Opens the WordWriter template specified by the templateFileName parameter. |
|
Opens the WordWriter template specified by the templateFileName parameter. |
|
Save(Microsoft.SharePoint.SPDocumentLibrary, String, Boolean) |
Saves the generated Word file to a SharePoint Document Library. |
Saves the generated Word file to a SharePoint List Item. | |
Sets a main document data source to a SharePoint List. If the specified List contains more than one row, WordWriter will use the first row as the data source. | |
Sets a main document data source to a SharePoint List. If the specified List contains more than one row, WordWriter will use the first row as the data source. | |
SetDataSource(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList, String) |
Sets a main document data source to a SharePoint View. If the specified View contains more than one row, WordWriter will use the first row as the data source. |
SetDataSource(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList) |
Sets a main document data source to a SharePoint View. If the specified View contains more than one row, WordWriter will use the first row as the data source. |
Sets the MailMerge's data source to a SharePoint View. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
Sets the MailMerge's data source to a SharePoint View. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. | |
SetMailMerge(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList, Int32) |
Sets the MailMerge's data source to a SharePoint View. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. |
SetMailMerge(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList) |
Sets the MailMerge's data source to a SharePoint View. A MailMerge by default treats the page content as a repeat block, repeating the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the NEXT field can also be used to indicate that the next row of data should be inserted instead of the current row at the next occurence of the merge fields. |
Sets the specified repeat block's data source to a SharePoint List. | |
Sets the specified repeat block's data source to a SharePoint List. | |
SetRepeatBlock(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList, String, Int32) |
Sets the specified repeat block's data source to a SharePoint View. |
SetRepeatBlock(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList, String) |
Sets the specified repeat block's data source to a SharePoint View. |