MIMEType Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
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; }Public Property MIMEType As StringExamples
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);Dim embeddedFile As New EmbeddedFile("terms.pdf", "Attachments\terms.pdf", "application/pdf")
embeddedFile.MIMEType = "application/pdf"
If Not String.IsNullOrWhiteSpace(embeddedFile.MIMEType) Then
Console.WriteLine($"MIMEType: {embeddedFile.MIMEType}")
End If
Dim saveSettings As New SaveSettings() With { .EmbeddedFiles = New EmbeddedFile() { embeddedFile } }
textControl.Save("contract-with-attachment.docx", StreamType.WordprocessingML, saveSettings)