C# Class EnterpriseWebLibrary.MailMerging.MergeOps

Contains methods that perform mail merging operations.
Afficher le fichier Open project: enduracode/enterprise-web-library

Méthodes publiques

Méthode Description
CreateExcelWorkbook ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, IEnumerable fieldNames, Stream destinationStream, bool useMsWordFieldNames = false ) : void

Creates a single-sheet Excel Workbook from the top level of a row tree and writes it to a stream. There will be one column for each merge field specified in the list of field names. Each column head will be named by calling ToEnglishFromCamel on the merge field's name or using the Microsoft Word name without modification, the latter if useMsWordFieldNames is true.

CreateMsWordDoc ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, Stream inputStream, Stream destinationStream ) : void

Merges a row tree with a Microsoft Word document. If you would like each row to be on a separate page, set the first paragraph in the input file to have a page break before it.

CreatePdf ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, MemoryStream sourcePdfStream, Stream destinationStream, bool useLegacyBehaviorOfIgnoringInvalidFields = false ) : void

Merges a row tree with a PDF document containing form fields.

CreatePdf ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, string sourcePdfFilePath, Stream destinationStream, bool useLegacyBehaviorOfIgnoringInvalidFields = false ) : void

Merges a row tree with a PDF document containing form fields.

CreatePdfFromMsWordDoc ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, string inputFilePath, Stream destinationStream ) : void

Merges a row tree with a Microsoft Word document and writes the result to a stream as a PDF document. If you would like each row to be on a separate page, set the first paragraph in the input file to have a page break before it.

CreateString ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRow row, bool ensureAllFieldsHaveValues, string template ) : string

Merges a row with a template string.

CreateTabularTextFile ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, IEnumerable fieldNames, TextWriter destinationWriter, bool useTabAsSeparator = false ) : void

Creates a comma-separated values (CSV) or tab-separated values file from the top level of a row tree. There will be one column for each merge field specified in the list of field names.

CreateXmlDocument ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, EnterpriseWebLibrary.MailMerging.MergeFieldNameTree fieldNameTree, Stream destinationStream ) : void

Creates an XML document from a row tree and writes it to a stream using UTF-8 encoding.

GetExcelSupportedMergeFields ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree ) : IEnumerable

Gets an IEnumerable of the merge field names from the top level of the specified row tree that are supported by the CreateExcelWorkbook method.

GetMergeFieldsInTemplateString ( string template ) : EnterpriseWebLibrary.MailMerging.MergeFieldNameTree

Gets a merge field name tree of the fields that exist in the specified template string.

GetTabularTextSupportedMergeFields ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree ) : IEnumerable

Gets the names of the merge fields from the top level of the specified row tree that are supported by the CreateTabularTextFile method.

GetXmlSupportedMergeFields ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree ) : EnterpriseWebLibrary.MailMerging.MergeFieldNameTree

Gets a merge field name tree of the fields that are supported by the CreateXmlDocument method.

Private Methods

Méthode Description
CreateExcelFileWriter ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, IEnumerable fieldNames, bool useMsWordFieldNames ) : EnterpriseWebLibrary.IO.ExcelFileWriter
Test ( ) : void
createMsWordDocOrPdfFromMsWordDoc ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, Stream inputStream, Stream destinationStream, bool saveAsMsWordDoc ) : void
getFieldsInTemplateString ( string template ) : IEnumerable
mergeValueTypeIsSupportedByExcel ( MergeValue mv ) : bool
mergeValueTypeIsSupportedInTabularText ( MergeValue mv ) : bool
mergeValueTypeIsSupportedInXml ( MergeValue mv ) : bool
writeRowTreeXmlElement ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, EnterpriseWebLibrary.MailMerging.MergeFieldNameTree fieldNameTree, XmlWriter writer ) : void

Method Details

CreateExcelWorkbook() public static méthode

Creates a single-sheet Excel Workbook from the top level of a row tree and writes it to a stream. There will be one column for each merge field specified in the list of field names. Each column head will be named by calling ToEnglishFromCamel on the merge field's name or using the Microsoft Word name without modification, the latter if useMsWordFieldNames is true.
public static CreateExcelWorkbook ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, IEnumerable fieldNames, Stream destinationStream, bool useMsWordFieldNames = false ) : void
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
fieldNames IEnumerable
destinationStream Stream
useMsWordFieldNames bool
Résultat void

CreateMsWordDoc() public static méthode

Merges a row tree with a Microsoft Word document. If you would like each row to be on a separate page, set the first paragraph in the input file to have a page break before it.
public static CreateMsWordDoc ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, Stream inputStream, Stream destinationStream ) : void
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
ensureAllFieldsHaveValues bool
inputStream Stream
destinationStream Stream
Résultat void

CreatePdf() public static méthode

Merges a row tree with a PDF document containing form fields.
public static CreatePdf ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, MemoryStream sourcePdfStream, Stream destinationStream, bool useLegacyBehaviorOfIgnoringInvalidFields = false ) : void
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
ensureAllFieldsHaveValues bool
sourcePdfStream System.IO.MemoryStream
destinationStream Stream
useLegacyBehaviorOfIgnoringInvalidFields bool
Résultat void

CreatePdf() public static méthode

Merges a row tree with a PDF document containing form fields.
public static CreatePdf ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, string sourcePdfFilePath, Stream destinationStream, bool useLegacyBehaviorOfIgnoringInvalidFields = false ) : void
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
ensureAllFieldsHaveValues bool
sourcePdfFilePath string
destinationStream Stream
useLegacyBehaviorOfIgnoringInvalidFields bool
Résultat void

CreatePdfFromMsWordDoc() public static méthode

Merges a row tree with a Microsoft Word document and writes the result to a stream as a PDF document. If you would like each row to be on a separate page, set the first paragraph in the input file to have a page break before it.
public static CreatePdfFromMsWordDoc ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, bool ensureAllFieldsHaveValues, string inputFilePath, Stream destinationStream ) : void
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
ensureAllFieldsHaveValues bool
inputFilePath string
destinationStream Stream
Résultat void

CreateString() public static méthode

Merges a row with a template string.
public static CreateString ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRow row, bool ensureAllFieldsHaveValues, string template ) : string
row EnterpriseWebLibrary.MailMerging.RowTree.MergeRow
ensureAllFieldsHaveValues bool
template string
Résultat string

CreateTabularTextFile() public static méthode

Creates a comma-separated values (CSV) or tab-separated values file from the top level of a row tree. There will be one column for each merge field specified in the list of field names.
public static CreateTabularTextFile ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, IEnumerable fieldNames, TextWriter destinationWriter, bool useTabAsSeparator = false ) : void
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
fieldNames IEnumerable
destinationWriter System.IO.TextWriter
useTabAsSeparator bool
Résultat void

CreateXmlDocument() public static méthode

Creates an XML document from a row tree and writes it to a stream using UTF-8 encoding.
public static CreateXmlDocument ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree, EnterpriseWebLibrary.MailMerging.MergeFieldNameTree fieldNameTree, Stream destinationStream ) : void
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
fieldNameTree EnterpriseWebLibrary.MailMerging.MergeFieldNameTree
destinationStream Stream
Résultat void

GetExcelSupportedMergeFields() public static méthode

Gets an IEnumerable of the merge field names from the top level of the specified row tree that are supported by the CreateExcelWorkbook method.
public static GetExcelSupportedMergeFields ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree ) : IEnumerable
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
Résultat IEnumerable

GetMergeFieldsInTemplateString() public static méthode

Gets a merge field name tree of the fields that exist in the specified template string.
public static GetMergeFieldsInTemplateString ( string template ) : EnterpriseWebLibrary.MailMerging.MergeFieldNameTree
template string
Résultat EnterpriseWebLibrary.MailMerging.MergeFieldNameTree

GetTabularTextSupportedMergeFields() public static méthode

Gets the names of the merge fields from the top level of the specified row tree that are supported by the CreateTabularTextFile method.
public static GetTabularTextSupportedMergeFields ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree ) : IEnumerable
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
Résultat IEnumerable

GetXmlSupportedMergeFields() public static méthode

Gets a merge field name tree of the fields that are supported by the CreateXmlDocument method.
public static GetXmlSupportedMergeFields ( EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree rowTree ) : EnterpriseWebLibrary.MailMerging.MergeFieldNameTree
rowTree EnterpriseWebLibrary.MailMerging.RowTree.MergeRowTree
Résultat EnterpriseWebLibrary.MailMerging.MergeFieldNameTree