Class QuoteDocumentGenerator
Class for generating mail-merged Quote documents based on a DataSet with multiple, related tables
Inherited Members
Namespace: SuperOfficeCRMSale
Assembly: SoDataBase.dll
Syntax
public class QuoteDocumentGenerator
Remarks
It's not quite arbitrary - the Thumbnail and Image fields, if present, lead to Quote images being fetched. There is also special functionality to merge two documents, also a requirement for Quote. Possibly not the prettiest thing we could do.
Constructors
QuoteDocumentGenerator(ILogger<QuoteDocumentGenerator>)
Declaration
public QuoteDocumentGenerator(ILogger<QuoteDocumentGenerator> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ILoggerQuoteDocumentGenerator | logger |
Fields
QuoteDetailsTag
Declaration
public const string QuoteDetailsTag = "QuoteDetails"
Field Value
| Type | Description |
|---|---|
| string |
Methods
MergeToPdf(Stream, Stream, DataSet)
Taking streams of bytes (main doc, lines doc) and a Dataset (merge data), produce a merged PDF document
Declaration
public Stream MergeToPdf(Stream template, Stream mainDoc, DataSet data)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | template | The template for the 'quote lines' document, containing Aspose tags |
| Stream | mainDoc | The main document, if there is one, to which the quote lines will be appended |
| DataSet | data | Merge data from the Quote Manager or another compatible source |
Returns
| Type | Description |
|---|---|
| Stream | Stream (backed by a byte array) containing a PDF document ready to save |
Remarks
If there is only a main doc, then it will be merged with the dataset and saved as PDF.
If there is only a details doc, then it will be merged with the database and saved as PDF.
If both are defined and there is no "QuoteDetails" tag in the main doc, then both will be merged with the dataset, and the details doc will be appended to the main doc. The result is saved as PDF.
If both are defined and the main doc contains a "QuoteDetails" tag, then both will be merged with the dataset, and the details doc will be inserted at the position of the tag in the main doc (the tag is removed).
PrescanForTags(Stream)
Declaration
public static string[] PrescanForTags(Stream content)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | content |
Returns
| Type | Description |
|---|---|
| string |
PrescanForTagsAsync(int, CancellationToken)
Find out which tags are present in a Word document; this is used to control the final data-generation process
Declaration
public static Task<string[]> PrescanForTagsAsync(int documentId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | documentId | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Taskstring |