Knowledgebase (2344)
Children categories
A file with the EMLX or EML file extension is a Mail Message file used to store an email message. EML/EMLX file can converted to MHTML or MSG file format with few lines of core code by using Spire.Email.
Convert EML/EMLX to MHTML
using Spire.Email;
using System;
namespace ConvertEMLandEMLXtoMHTML
{
class Program
{
static void Main(string[] args)
{
MailMessage message = MailMessage.Load("example.eml");
message.Save("ToMhtml.mhtml", MailMessageFormat.Mhtml);
Console.WriteLine("Done");
}
}
}
Imports Spire.Email
Namespace ConvertEMLandEMLXtoMHTML
Class Program
Private Shared Sub Main(args As String())
Dim message As MailMessage = MailMessage.Load("example.eml")
message.Save("ToMhtml.mhtml", MailMessageFormat.Mhtml)
Console.WriteLine("Done")
End Sub
End Class
End Namespace
Convert EML/EMLX to MSG
using Spire.Email;
using System;
namespace ConvertEMLandEMLXtoMSG
{
class Program
{
static void Main(string[] args)
{
MailMessage message = MailMessage.Load("example.eml");
message.Save("ToMsg.msg", MailMessageFormat.Msg);
Console.WriteLine("Done");
}
}
}
Imports Spire.Email
Namespace ConvertEMLandEMLXtoMSG
Class Program
Private Shared Sub Main(args As String())
Dim message As MailMessage = MailMessage.Load("example.eml")
message.Save("ToMsg.msg", MailMessageFormat.Msg)
Console.WriteLine("Done")
End Sub
End Class
End Namespace
We have already demonstrated how to use Spire.Doc to add shapes to word document from code. Spire.Doc also supports to remove a single shape by index or clear all the shapes from the word document. This article will illustrates how to remove the shape from word document in C# and VB.NET.
Sample word document with shapes:

Step 1: Initialize a new instance of Document class and load the document from file.
Document doc = new Document();
doc.LoadFromFile("Shapes.docx",FileFormat.Docx2010);
Step 2: Get the first section from the document and the first paragraph from the section.
Section section = doc.Sections[0]; Paragraph para = section.Paragraphs[0];
Step 3: Get shapes from the first paragraph.
ShapeObject shape = para.ChildObjects[0] as ShapeObject;
Step 4: Remove the shape or all the shapes.
//remove the third shape. para.ChildObjects.RemoveAt(2); ////clear all the shapes. //para.ChildObjects.Clear();
Step 5: Save the document to file.
doc.SaveToFile("Removeshape.docx",FileFormat.Docx2010);
Effective screenshot after removing one shape from the word document:

Full codes:
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
namespace RemoveShape
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
doc.LoadFromFile("Shapes.docx", FileFormat.Docx2010);
Section section = doc.Sections[0];
Paragraph para = section.Paragraphs[0];
ShapeObject shape = para.ChildObjects[0] as ShapeObject;
//remove the third shape.
para.ChildObjects.RemoveAt(2);
////clear all the shapes.
//para.ChildObjects.Clear();
doc.SaveToFile("Removeshape.docx", FileFormat.Docx2010);
}
}
}
Imports Spire.Doc
Imports Spire.Doc.Documents
Imports Spire.Doc.Fields
Namespace RemoveShape
Class Program
Private Shared Sub Main(args As String())
Dim doc As New Document()
doc.LoadFromFile("Shapes.docx", FileFormat.Docx2010)
Dim section As Section = doc.Sections(0)
Dim para As Paragraph = section.Paragraphs(0)
Dim shape As ShapeObject = TryCast(para.ChildObjects(0), ShapeObject)
'remove the third shape.
para.ChildObjects.RemoveAt(2)
'''/clear all the shapes.
'para.ChildObjects.Clear();
doc.SaveToFile("Removeshape.docx", FileFormat.Docx2010)
End Sub
End Class
End Namespace
Spire.Email supports to manage folder subscriptions by using ImapClient.Subscribe and ImapClient.Unsubscribe method.
The following example shows how to subscribe to a folder and unsubscribe from a folder using Spire.Email component.
Detail steps:
Step 1: Create an ImapClient instance.
ImapClient imap = new ImapClient();
Step 2: Set host, port, authentication and connection protocol.
imap.Host = "outlook.office365.com"; imap.Port = 143; imap.Username = "LeonDavisLD@outlook.com"; imap.Password = "password"; imap.ConnectionProtocols = ConnectionProtocols.Ssl;
Step 3: Connect the imap server.
imap.Connect();
Step 4: Subscribe folder using its name.
imap.Subscribe("Folder1");
Step 5: Unsubscribe folder.
imap.Unsubscribe("Folder2");
Screenshot:

Full code:
using Spire.Email;
using Spire.Email.IMap;
namespace SubscribAndUnsubscribeFolders
{
class Program
{
static void Main(string[] args)
{
//Create an ImapClient instance
ImapClient imap = new ImapClient();
//Set host, port, authentication and connection protocol
imap.Host = "outlook.office365.com";
imap.Port = 143;
imap.Username = "LeonDavisLD@outlook.com";
imap.Password = "password";
imap.ConnectionProtocols = ConnectionProtocols.Ssl;
//Connect the imap server
imap.Connect();
//subscribe folder using its name
imap.Subscribe("Folder1");
//Unsubscribe folder
imap.Unsubscribe("Folder2");
}
}
}
Imports Spire.Email
Imports Spire.Email.IMap
Namespace SubscribAndUnsubscribeFolders
Class Program
Private Shared Sub Main(args As String())
'Create an ImapClient instance
Dim imap As New ImapClient()
'Set host, port, authentication and connection protocol
imap.Host = "outlook.office365.com"
imap.Port = 143
imap.Username = "LeonDavisLD@outlook.com"
imap.Password = "password"
imap.ConnectionProtocols = ConnectionProtocols.Ssl
'Connect the imap server
imap.Connect()
'subscribe folder using its name
imap.Subscribe("Folder1")
'Unsubscribe folder
imap.Unsubscribe("Folder2")
End Sub
End Class
End Namespace