Message-ID: <1748811847.9549.1711694248477.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9548_672829786.1711694248477" ------=_Part_9548_672829786.1711694248477 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html WordTemplate

WordTemplate

Description

=20

The WordTemplate object represents a WordWriter template. A WordWriter t= emplate is a file created in Microsoft Word that contains merge fields.

= =20
C#
=20
public sealed class WordTemplate
=20
=20
vb.net
=20
Public NotInheritable Class WordTemplate
=20
=20

Remarks

The=20 WordTemplate object is in the SoftArtisans.OfficeWriter.WordWr= iter namespace. The object can be referenced as=20 SoftArtisans.WordWriter.WordTemplate. To minimize typing and e= rrors, import the namespace to the aspx page, and reference the object as= =20 WordTemplate, without the namespace prefix.=20

Examples

=20

If you are coding directly in the .aspx page, following the Page directi= ve, include:

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

If you are coding in the "code behind" page (.aspx.vb or .aspx= .cs), include an Imports or using statement at th= e top of the "code behind" page:

=20
C#
=20
using SoftArtisans.OfficeWriter.WordWriter;
=20
=20
vb.net
=20
Imports SoftArtisans.OfficeWriter.WordWriter
=20
=20

To create an instance of the WordTemplate object use:

=20
C#
=20
WordTemplate wt =3D new WordTemplate();
=20
=20
vb.net
=20
Dim wt As New WordTemplate()
=20
=20

Fields

=20
=20 =20 =20 =20 =20

ALL_ROWS

Used by SetDataSource to indicate that as much of the data sour= ce should be imported as possible.

=20

Properties

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20

Name

Description

Bookmarks

Returns the names of all bookmarks in a WordWri= ter template.

ContentType

Sets or returns the content-type header that wi= ll be sent to the browser with the generated Word document.

CultureInfo

The CultureInfo property allows you to override the server's default= locale when generating a new Word file. For example, to generate a US Engl= ish document on a French operating system, you could use CultureInfo<= /code> to set the Word file's Syst= em.Globalization.CultureInfo to US English.

DataSourceSeparator

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.

EnableNEXTFields

Gets or sets whether NEXT fields should be enab= led in the WordTemplate. If NEXT fields are enabled, the data source will m= ove to the next row of data when merge field is repeated in the template fi= le.

FieldMarkers

Returns the names of all merge fields in the ma= in document.

LicenseKey

Sets or returns the registered 23-character lic= ense key that enables WordWriter.

PreserveFields

Gets or sets whether merge fields and next fiel= ds should be preserved after processing the WordTemplate.

SaveExtension

The extension that should be used when savin= g this template; based on the input file.

UnlinkIfFields

Gets or sets whether IF fields will be unlinked= from the document after they are evaluated.

UpdateIfFields

Gets or sets whether IF fields should be evalua= ted server-side in the WordTemplate.

Version

Returns the exact version of WordWriter.
=20

Methods

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 = =20 = =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20

Name

Description

BookmarkFieldMarkers(String)

Returns the names of all merge fields in the sp= ecified bookmark.

Open(String)

Opens the WordWriter template specified by the = templateFileName parameter.

Open(System.IO.Stream)

Opens a WordWriter template from a System.IO.Stream. A WordWriter templa= te is a file created in Microsoft Word that contains merge fields.

Open(WordApplication, Document)

Passes a document from WordApplication to WordTemplate.

Process()

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 memor= y.

Save(String)

Saves the generated Word file on the server. =20

Save(System.IO.Stream)

Sends the generated Word binary file to the spe= cified System.IO.Stream o= r, a class derived from System.IO.Stream (for example, System.IO.FileStream).

Save(System.Web.HttpResponse)

If you pass Save an HttpResponse object object, WordWriter will stream the generated file to the cli= ent. If the user chooses to open (rather than save) the file, it will open = in the browser window.

Save(System.Web.HttpResponse, String, Boolean)

If you pass save an HttpServletRes= ponse 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.

SetDataSource(Object(), String(), String)

Sets a main document data source to a one-dimen= sional object array. The method imports a single row of data to the specifi= ed set of main document merge fields.

SetDataSource(Object(), String())

Sets a main document data source to a one-dimen= sional object array. The method imports a single row of data to the specifi= ed set of main document merge fields.

SetDataSource(System.Data.DataSet, String)

Sets a main document data source to an ADO.NET = DataSet. A DataSet contains a collection of DataTables. If you set a main d= ocument data source to a DataSet, WordWriter will get the first row of the = first DataTable in the DataSet.

SetDataSource(System.Data.DataSet)

Sets a template's data source to an ADO.NET Dat= aSet. 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.

SetDataSource(System.Data.DataTable, String)

Sets a main document data source to an ADO.NET = DataTable. If the specified DataTable contains more than one row, WordWrite= r will use the first row as the data source.

SetDataSource(System.Data.DataTable)

Sets a template's data source to an ADO.NET Dat= aTable. If the specified DataTable contains more than one row, WordWriter w= ill use the first row as the data source.

SetDataSource(System.Data.IDataReader, String)

Sets a main document data source to an an IData= Reader 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.

SetDataSource(System.Data.IDataReader)

Sets a template's data source to an an IDataRea= der interface, which may be either a SqlDataReader, OleDbDataReader or an A= domdDataReader. If the specified DataReader returns more than one row, Word= Writer will use the first row as the data source.

SetDataSource(Object, String)

Sets the data source for the specified main doc= ument merge field to an object. The main document is the p= art of the document that is not within a repeat block.

SetDataSource(System.Collections.IEnumerator, String())

=20
Sets an IEnumerator collection as a data source to bind to a specified s= et of main document merge fields.

SetDataSource(System.Collections.IEnumerator, String(), String) =

Sets an IEnumerator collection as a data source to bind to a specified s= et of main document merge fields.

SetDataSource(System.Collections.IDictionary)

Sets a template's main document data source to = an IDictionary collection= . An IDictionary represents a collection of key-and-value pair= s.

SetDataSource(System.Collections.IDictionary, String)

Sets a template's main document data source to = an IDictionary collection= . An IDictionary represents a collection of key-and-value pair= s.

SetDataSource(System.Collections.ICollection, String())

=20
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 s= et of main document merge fields.

SetMailMerge(Object(,), String())

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds. This should largely imitate the behavior of a Microsoft Word Mail merge= .

SetMailMerge(Object(,), String(), Int32, Boolean)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds. This should largely imitate the behavior of a Microsoft Word Mail merge= .

SetMailMerge(Object(), String())

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds. This should largely imitate the behavior of a Microsoft Word Mail merge= .

SetMailMerge(Object()(), String())

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds. This should largely imitate the behavior of a Microsoft Word Mail merge= .

SetMailMerge(Object()(), String(), Int32, Boolean)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds. This should largely imitate the behavior of a Microsoft Word Mail merge= .

SetMailMerge(System.Collections.ICollection)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the en= tire 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 conte= nt 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 r= ow of data should be inserted instead of the current row at the next occure= nce of the merge fields. This should largely imitate the behavior of a Micr= osoft Word Mail merge.

SetMailMerge(System.Collections.IEnumerator)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds. This should largely imitate the behavior of a Microsoft Word Mail merge= .

SetMailMerge(System.Data.DataSet)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds.

SetMailMerge(System.Data.DataSet, Int32)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds.

SetMailMerge(System.Data.DataTable)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds.

SetMailMerge(System.Data.DataTable, Int32)

Sets the MailMerge's data source to a DataTable= . A MailMerge by default treats the page content as a repeat block, repeati= ng the page content for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFie= lds property is set to true, the NEXT field can also be used to indicat= e that the next row of data should be inserted instead of the current row a= t the next occurence of the merge fields.

SetMailMerge(System.Data.IDataReader)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds.

SetMailMerge(System.Data.IDataReader, Int32)

Sets the MailMerge's data source to a two-dimen= sional (rectangular) array of objects. A MailMerge by default treats the pa= ge content as a repeat block, repeating the page content for each row unles= s NEXT fields are used. If the WordTemplate.EnableNEXTFields property is set to true, the N= EXT 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 fiel= ds.

SetRepeatBlock(System.Data.DataSet, String)

Sets the specified repeat block's data source t= o 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 docum= ent, repeat blocks are defined by Word bookmarks that contain merge fields.=

SetRepeatBlock(System.Data.DataSet, String, Int32)

Sets the specified repeat block's data source t= o an ADO.NET DataSet.

SetRepeatBlock(System.Data.DataTable, String)

Sets the specified repeat block's data source t= o an ADO.NET DataTable.

SetRepeatBlock(System.Data.DataTable, String, Int32)

Sets the specified repeat block's data source t= o an ADO.NET DataTable.

SetRepeatBlock(System.Data.IDataReader, String)

Sets the specified repeat block's data source t= o an IDataReader interface, which may be either a SqlDataReader, OleDbDataR= eader or an AdomdDataReader.

SetRepeatBlock(System.Data.IDataReader, String, Int32)

Sets the specified repeat block's data source t= o an IDataReader interface, which may be either a SqlDataReader, OleDbDataR= eader, or an AdomdDataReader.

SetRepeatBlock(Object(), String(), String)

Sets the specified repeat block's data source t= o a 1-dimensional array of objects.

SetRepeatBlock(Object(,), String(), String)

Sets the specified repeat block's data source t= o a multidimensional (rectangular) array of objects.

SetRepeatBlock(Object(,), String(), String, Int32, Boolean)

=
Sets the specified repeat block's data source t= o a multidimensional (rectangular) array of objects.

SetRepeatBlock(Object()(), String(), String)

Sets the specified repeat block's data source t= o a jagged array (array-of-arrays) of objects.

SetRepeatBlock(Object()(), String(), String, Int32, Boolean)

Sets the specified repeat block's data source t= o a jagged array (array-of-arrays) of objects.

SetRepeatBlock(System.Collections.IEnumerator, String)

Sets the specified repeat block's data source t= o an IEnumerator collecti= on.

SetRepeatBlock(System.Collections.IEnumerator, String, String) <= /p>

Sets the specified repeat block's data source t= o an IEnumerator collecti= on.

SetRepeatBlock(System.Collections.ICollection, String)

Sets the specified repeat block's data source t= o an ICollection.

SetRepeatBlock(System.Collections.ICollection, String, String) <= /p>

Sets the specified repeat block's data source t= o an ICollection.

WordTemplate()

Creates a new WordTemplate object.

=20

Extension Methods

=20

In= troduced in build 4.5

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Overload

Description

Open(Microsoft.SharePoint.SPDocumentLibrary, String)

Opens the WordWriter template specified by the <= code>templateFileName parameter.

Open(Microsoft.SharePoint.SPListItem, String)

Opens the WordWriter template specified by the <= code>templateFileName parameter.

Save(Microsoft.SharePoint.SPDocumentLibrary, String, Boolean)

=
Saves the generated Word file to a SharePoint Do= cument Library.

Save(Microsoft.SharePoint.SPListItem, String)

Saves the generated Word file to a SharePoint Li= st Item.

SetDataSource(Microsoft.SharePoint.SPList, String)

Sets a main document data source to a SharePoint= List. If the specified List contains more than one row, WordWriter will us= e the first row as the data source.

SetDataSource(Microsoft.SharePoint.SPList)

Sets a main document data source to a SharePoint= List. If the specified List contains more than one row, WordWriter will us= e the first row as the data source.

SetDataSource(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPLis= t, String)

Sets a main document data source to a SharePoint= View. If the specified View contains more than one row, WordWriter will us= e the first row as the data source.

SetDataSource(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPLis= t)

Sets a main document data source to a SharePoint= View. If the specified View contains more than one row, WordWriter will us= e the first row as the data source.

SetMailMerge(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, re= peating the page content for each row unless NEXT fields are used. If the <= a href=3D"/display/WW8/WordTemplate.EnableNEXTFields">WordTemplate.EnableNE= XTFields property is set to true, the NEXT field can also be used to in= dicate 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.SPList)

Sets the MailMerge's data source to a SharePoint= View. A MailMerge by default treats the page content as a repeat block, re= peating the page content for each row unless NEXT fields are used. If the <= a href=3D"/display/WW8/WordTemplate.EnableNEXTFields">WordTemplate.EnableNE= XTFields property is set to true, the NEXT field can also be used to in= dicate 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, re= peating the page content for each row unless NEXT fields are used. If the <= a href=3D"/display/WW8/WordTemplate.EnableNEXTFields">WordTemplate.EnableNE= XTFields property is set to true, the NEXT field can also be used to in= dicate 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, re= peating the page content for each row unless NEXT fields are used. If the <= a href=3D"/display/WW8/WordTemplate.EnableNEXTFields">WordTemplate.EnableNE= XTFields property is set to true, the NEXT field can also be used to in= dicate that the next row of data should be inserted instead of the current = row at the next occurence of the merge fields.

SetRepeatBlock(Microsoft.SharePoint.SPList, String, Int32)

=20
Sets the specified repeat block's data source to= a SharePoint List.

SetRepeatBlock(Microsoft.SharePoint.SPList, String)

Sets the specified repeat block's data source to= a SharePoint List.

SetRepeatBlock(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPLi= st, String, Int32)

Sets the specified repeat block's data source to= a SharePoint View.

SetRepeatBlock(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPLi= st, String)

Sets the specified repeat block's data source to= a SharePoint View.
------=_Part_9548_672829786.1711694248477--