EmbeddedFile Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.dll
Description
The EmbeddedFile class represents a file embedded in another document. It is used with the LoadSettings.EmbeddedFiles and SaveSettings.EmbeddedFiles properties, currently only supported for PDF and PDF/A documents. An embedded file is specified through its name and its data and further optional properties such as a description string or a creation date.
Syntax
public class EmbeddedFilePublic Class EmbeddedFileExamples
The following example embeds a PDF attachment and preserves its media type during WordprocessingML export.
EmbeddedFile embeddedFile = new("terms.pdf", @"Attachments\terms.pdf", "application/pdf");
SaveSettings saveSettings = new() { EmbeddedFiles = new[] { embeddedFile } };
textControl.Save("contract-with-attachment.docx", StreamType.WordprocessingML, saveSettings);Dim embeddedFile As New EmbeddedFile("terms.pdf", "Attachments\terms.pdf", "application/pdf")
Dim saveSettings As New SaveSettings() With { .EmbeddedFiles = New EmbeddedFile() { embeddedFile } }
textControl.Save("contract-with-attachment.docx", StreamType.WordprocessingML, saveSettings)Members
Constructors
| Constructor | Description |
|---|---|
| EmbeddedFile | Initializes a new instance of the EmbeddedFile class. |
Properties
| Property | Description |
|---|---|
| CreationDate | Gets or sets the file's creation date. When a document is saved and this property is null, the creation date of the embedded file is set to the creation date of the containing document. |
| Data | Gets the file's data. It can be either a string or binary data given as an array of bytes. |
| Description | Gets or sets an optional file description. It is null, if the file has no description. |
| FileName | Gets the file's name. It can include a relative or absolute path. |
| LastModificationDate | Gets or sets the date the file was last modified. When a document is saved and this property is null, the modification date of the embedded file is set to the modification date of the containing document. |
| MIMEType | Gets or sets an optional string specifying the file's type using types specified through the Multipurpose Internet Mail Extensions (MIME) specification. When a file is embedded and a type is not specified the default type application/octet-stream is used. |
| Relationship | PDF/A only. Gets or sets an optional string describing the relationship of the embedded file and the containing document. This string can be a predefined value or should follow the rules for second-class names (ISO 32000-1, Annex E). Predefined values are "Source", "Data", "Alternative", "Supplement" or "Unspecified". It is null, if a relationship string is not available. |
Methods
| Method | Description |
|---|---|
| GetUnmanagedBufferSize | Not described in the reference. public int GetUnmanagedBufferSize(); |