MS Word provides a range of exciting features to create rich text documents. You can enrich your DOC documents with text formatting, tables, graphics, images, WordArt, and so on. In certain cases, you may need to import a PNG image to the DOC document programmatically. Or you may get a batch of PNG images that you need to convert into a DOC file. To achieve that, this article shows how to convert PNG images to DOC in C# .NET
C# PNG to DOC Converter - Free Download
To convert PNG images to DOC, 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 DOC 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 DOC in C# using Aspose.Words for .NET.
- Install Aspose.Words for .NET in your application.
- Create a new DOC document.
- Insert PNG image into the document using PNG file’s path.
- Save DOC file to your desired location.
Convert PNG to DOC in C#
Let’s have a look at how to transform the above-mentioned steps for PNG to DOC conversion into the C# code. The following are the steps to convert a PNG to DOC 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 DOC document using Document.Save(string) method.
The following code sample shows how to convert a PNG to DOC in C#.
C# PNG to DOC 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 DOC in C#. You can simply install Aspose.Words in your application and convert single or batch of PNG images to a DOC 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.