MS Word has been in the business for many years that provides a bunch of features to create rich text documents. In addition to text formatting, you can use various graphical objects and images in the DOCX documents. In certain cases, you may get a batch of images that you need to convert into a DOCX document. To achieve that, this article shows how to convert image to DOCX in C# .NET.
- C# Image to DOCX Converter - Free Download
- Steps to Convert Image to DOCX in C#
- Convert Image to DOCX in C#
Image to DOCX C# Converter - Free Download
Aspose.Words for .NET is designed to create and manipulate Word documents from within .NET applications. In addition, it provides a built-in converter to convert document and images to other formats. We will use this API to convert images to DOCX. 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 Image to DOCX in C#
Aspose.Words for .NET simplifies the image to DOCX conversion by taking care of complex conversion operations. The following are the steps to convert an image to DOCX in C# using Aspose.Words.
- Install Aspose.Words for .NET in your application.
- Create a new DOCX document.
- Insert image into the document using image file’s path.
- Save document to your desired location.
Convert Image to DOCX in C#
Now let’s have a look at how the above-mentioned steps will be translated into the C# code. The following are the steps to convert an image to DOCX in C#.
- Create an object of Document class.
- Create an object of DocumentBuilder class.
- Insert image into the document by its path using DocumentBuilder.InsertImage(string) method.
- Save the resultant DOCX document using Document.Save(string) method.
The following code sample shows how to convert an image to DOCX in C#.
C# Image to DOCX 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 an image to DOCX in C#. You can simply install Aspose.Words in your application and convert single or batch of images to a DOCX 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.