How to Convert Word to Emf in C#

The article will introduce an easy way to convert Word to Emf by a powerful and independent Word .NET component called Spire.Doc, without Microsoft Word installed on the machine. It also offers support for converting Word and HTML to frequently-used image formats like Jpeg, Png, Gif, Bmp and Tiff, etc. Just click here to have a try.

Emf is a file extension for Enhanced MetaFile, used as a graphics language for printer drivers by the Windows operating system. In 1993, a newer version with additional commands 32-bit version of Win32/GDI introduced the Enhanced Metafile (Emf). Microsoft also recommends enhanced-format (Emf) functions to be used instead of rarely being used Windows-format (WMF) functions.

Spire.Doc presents almost the easiest solution to convert Word to Emf through the following 5 lines simple code.

[C#]
using Spire.Doc;
using System.Drawing.Imaging;


namespace DOCEMF
{
    class Program
    {
        static void Main(string[] args)
        {
            // create an instance of Spire.Doc.Document
            Document doc = new Document();
            // load the file base on a specified file name
            doc.LoadFromFile(@"../../Original Word.docx", FileFormat.Docx);
            //convert the first page of document to image
            System.Drawing.Image image = doc.SaveToImages(0, Spire.Doc.Documents.ImageType.Metafile);
            // save the document object to Emf file
            image.Save(@"../../Convert Word to Image.emf", ImageFormat.Emf);
            //close the document
            doc.Close();

        }
    }
}

Check the effect screenshot below:

word to emf c#