TX Text Control .NET for WPF

MIMEType Property

Property|Introduced in 29.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

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.

Syntax

public string MIMEType { get; set; }

Examples

The following example configures a PDF attachment before embedding it in a WordprocessingML document by using EmbeddedFile.MIMEType.

EmbeddedFile embeddedFile = new("terms.pdf", @"Attachments\terms.pdf", "application/pdf");

embeddedFile.MIMEType = "application/pdf";
if (!string.IsNullOrWhiteSpace(embeddedFile.MIMEType))
{
    Console.WriteLine($"MIMEType: {embeddedFile.MIMEType}");
}

SaveSettings saveSettings = new() { EmbeddedFiles = new[] { embeddedFile } };
textControl.Save("contract-with-attachment.docx", StreamType.WordprocessingML, saveSettings);