MS Word provides a range of exciting features to create rich text documents. You can enrich your documents with text formatting, tables, graphics, images, WordArt, and so on. In certain cases, you may need to import a PNG image to the Word document programmatically. Or you may get a batch of PNG images that you need to convert into a Word document. To achieve that, this article shows how to convert PNG images to Word in C# .NET.
C# PNG to Word Converter - Free Download
To convert PNG images to Word document, we will use Aspose.Words for .NET. It is an amazing API which is primarily developed to create and manipulate Word documents. In addition, it provides a high-speed and high-fidelity converter to convert document and images files. You can download the API’s DLL or install it from NuGet using the package manager console.
PM> Install-Package Aspose.Words
Steps to Convert PNG to Word in C#
Aspose.Words for .NET hides the complex conversion operations and allows you convert any document or image file within a few steps. The following are the steps to convert a PNG to Word in C# using Aspose.Words for .NET.
- Install Aspose.Words for .NET in your application.
- Create a new Word document.
- Insert PNG image into the document using PNG file’s path.
- Save document to your desired location.
Convert PNG to Word in C#
Let’s have a look at how to transform the above-mentioned steps for PNG to Word conversion into the C# code. The following are the steps to convert a PNG to Word in C#.
- Create an instance of Document class.
- Create an instance of DocumentBuilder class and initialize it with Document object.
- Insert PNG image into the document by its path using DocumentBuilder.InsertImage(string) method.
- Save the output Word document using Document.Save(string) method.
The following code sample shows how to convert a PNG to Word in C#.
C# PNG to Word Converter - Get a Free License
You can use Aspose.Words for .NET without evaluation limitations using a temporary license.
In this article, you have learned how to convert a PNG to Word in C#. You can simply install Aspose.Words in your application and convert single or batch of PNG images to a Word document in C#. Furthermore, you can explore other features offered by the API using the documentation. Also, you can feel free to ask your questions via our forum.