Class PhysicalDocumentTemplate
Wraps the stream access to the document template contents. Primarily for access to Mail Templates. See also PhysicalDocument
Inherited Members
Namespace: SuperOffice.CRM.Documents
Assembly: SoDataBase.dll
Syntax
public class PhysicalDocumentTemplate
Properties
DocumentTemplateInfo
Return the document template info passed to constructor. NULL if mail template path was passed to constructor.
Declaration
public IDocumentTemplateInfo DocumentTemplateInfo { get; }
Property Value
Type | Description |
---|---|
IDocumentTemplateInfo |
Methods
GetDocumentTemplate(IDocumentTemplateInfo)
Get a document template - stored in SO_ARC or similar.
Declaration
public static PhysicalDocumentTemplate GetDocumentTemplate(IDocumentTemplateInfo documentTemplateInfo)
Parameters
Type | Name | Description |
---|---|---|
IDocumentTemplateInfo | documentTemplateInfo | AutoEventId and DocumentStoredInPluginId values |
Returns
Type | Description |
---|---|
PhysicalDocumentTemplate | Object with access to template streams |
GetDocumentTemplate(string, bool)
Get a mail template based on filename
Declaration
public static PhysicalDocumentTemplate GetDocumentTemplate(string templateName, bool allowPersonal)
Parameters
Type | Name | Description |
---|---|---|
string | templateName | filename of template (e.g. "mail.htm") |
bool | allowPersonal | If true, look for personal template in user area |
Returns
Type | Description |
---|---|
PhysicalDocumentTemplate | Object with access to template streams |
LoadAsync(string, CancellationToken)
Load a template based on information provided about it
Declaration
public Task<Stream> LoadAsync(string culture, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | culture | Language code for template. "nb-NO" or NULL for default. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Stream> | Stream to read the document template from. |
LoadAsync(CancellationToken)
Load a template based on information provided about it
Declaration
public Task<Stream> LoadAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Stream> | Stream to read the document template from. |
SaveAsync(Stream, string, CancellationToken)
Save a template based on information about it (e.g. DocumentTemplateInfo).
Declaration
public Task SaveAsync(Stream template, string culture, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | template | Stream to read the document template from. Closes the stream when finished. |
string | culture | Language variant of the template to save to. "nb-NO" or NULL for default. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Remarks
If the document template file does not exist from before, the document template file is created. Does not provide a language code. i.e. only saves default templates.
SaveAsync(Stream, CancellationToken)
Save a document or mail template based on information about it (e.g. DocumentTemplateInfo). Saves to the default template - not a language specific variant.
Declaration
public Task SaveAsync(Stream template, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | template | Stream to read the document template from. Closes the stream when finished. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Remarks
If the document template file does not exist from before, the document template file is created. Does not provide a language code. i.e. only saves default templates.