How to Convert Word to SVG (Scalable Vector Graphics) in C#

2016-10-24 06:40:17 Written by  support iceblue
Rate this item
(0 votes)

SVG (Scalable Vector Graphics) is an image file format and it has the advantage of be edited and indexed easily. It is widely used for interactivity and animation. Starts from Spire.Doc V5.8, Spire.Doc offers a method doc.SaveToFile() to enable developers to save the word document to SVG file format in C# easily. This article will focus on demonstrate how to convert word document to SVG with the help of Spire.Doc by using a simple line of code in C#.

Firstly, please view the original word document:

How to Convert Word to SVG (Scalable Vector Graphics) in C#

Step 1: Create a C# project in visual studio, then add a reference to Spire.Doc.dll and use the following namespace.

using Spire.Doc;

Step 2: Create a word instance and load the source word document from file.

Document doc = new Document();
doc.LoadFromFile("Sample.docx");

Step 3: Save the document to SVG file.

doc.SaveToFile("result.svg", FileFormat.SVG);

After running the code, we'll get the effective screenshot of the following result SVG file from word document:

How to Convert Word to SVG (Scalable Vector Graphics) in C#

Full codes:

using Spire.Doc;

namespace wordconversion.Case
{
    class WordtoSVG
    {

         public WordtoSVG()
         {
        Document doc = new Document();
        doc.LoadFromFile("Sample.docx");

        doc.SaveToFile("result.svg", FileFormat.SVG);
         }

    }
}

Additional Info

  • tutorial_title: Convert Word to SVG in C#
Last modified on Friday, 03 September 2021 03:22