JPG is one of the commonly used image formats. JPG format supports lossy compression which reduces the file size of the images. There could be the case when you need to import a JPG image to the Word DOCX from within your .NET applications. Also, you may get a batch of JPG images that you need to convert into a DOCX document. To achieve that, this article shows how to convert JPG images to DOCX in C# .NET.
C# JPG to DOCX Converter - Free Download
To convert JPG images to a DOCX, we will use Aspose.Words for .NET. The API is designed to create and manipulate DOCX documents from within .NET applications. In addition, it provides a high quality converter for the conversion of document and image 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 JPG to DOCX in C#
Aspose.Words for .NET makes it quite easier for you to convert JPG images to DOCX within a few steps. The following are the steps to convert a JPG to DOCX using Aspose.Words for .NET.
- Install Aspose.Words for .NET in your application.
- Create a new DOCX document.
- Insert JPG image into the document using JPG file’s path.
- Save document to your desired location.
Convert JPG to DOCX in C#
The following are the steps along with classes and methods to convert a JPG image to DOCX in C#.
- Create an instance of Document class.
- Create an instance of DocumentBuilder class and initialize it with Document object.
- Insert JPG image into the document by its path using DocumentBuilder.InsertImage(string) method.
- Save the output DOCX using Document.Save(string) method.
The following code sample shows how to convert a JPG to DOCX in C#.
C# JPG to DOCX Converter - Get a Free License
You can use Aspose.Words for .NET without evaluation limitations using a free temporary license.
In this article, you have learned how to convert a JPG to DOCX in C#. You can simply install Aspose.Words in your application and convert single or batch of JPG images to a DOCX 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.