# EmbeddedFile Class

> 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.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 29.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > EmbeddedFile Class
- **1117 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/llms-full.txt

---

### Description

The EmbeddedFile class represents a file embedded in another document. It is used with the [LoadSettings.EmbeddedFiles](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsavesettingsbase/embeddedfiles-property/llms-full.txt) and [SaveSettings.EmbeddedFiles](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsavesettingsbase/embeddedfiles-property/llms-full.txt) 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

```csharp
public class EmbeddedFile
```

```vbnet
Public Class EmbeddedFile
```

### Examples

The following example embeds a PDF attachment and preserves its media type during WordprocessingML export.

```csharp
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);
```

```vbnet
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)
```

---

## In This Section

- [EmbeddedFile Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/constructor/llms-full.txt): Initializes a new instance of the EmbeddedFile class.
- [EmbeddedFile.CreationDate Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/creationdate-property/llms-full.txt): 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.
- [EmbeddedFile.Data Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/data-property/llms-full.txt): Gets the file's data. It can be either a string or binary data given as an array of bytes.
- [EmbeddedFile.Description Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/description-property/llms-full.txt): Gets or sets an optional file description. It is null, if the file has no description.
- [EmbeddedFile.FileName Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/filename-property/llms-full.txt): Gets the file's name. It can include a relative or absolute path.
- [EmbeddedFile.LastModificationDate Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/lastmodificationdate-property/llms-full.txt): 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.
- [EmbeddedFile.MIMEType Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/mimetype-property/llms-full.txt): 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.
- [EmbeddedFile.Relationship Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/relationship-property/llms-full.txt): 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.

---

## Nearby

- **Previous:** [EmbeddedDataFormat Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddeddataformat/enumeration/llms-full.txt)
- **Next:** [EmbeddedFile Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/embeddedfile/constructor/llms-full.txt)
