How to Resize a Picture in Word using C#

This tutorial guides on how to resize a picture in Word using C#. It provides details about the IDE settings, a step-wise process to write this application, and a runnable sample code to resize image in ms Word using C# and save it on the disk in DOCX, DOC, or any other MS Word-supported format. You will also learn about the classes, methods, and properties used for writing this application.

Steps to Resize Image in Word using C#

  1. Establish the environment to add Aspose.Words in the application to resize the images
  2. Create a new Word file using the Document class object to add resized photos
  3. Instantiate the DocumentBuilder class object for the newly created document
  4. Use the Write() and InsertImage() methods to insert sample text and images with their original sizes
  5. Get a reference to a particular image and change its size by setting width and height in points
  6. Save the resultant Word file on the disk with resized images

These steps describe the process to resize photo in Word using C# by sharing the configuration information, and then step-wise approach to accomplish the task. First, you need to create an empty Word document and then instantiate the DocumentBuilder class object to insert different elements like text, images, etc. The InsertImage() method returns the reference to the newly inserted image to set its properties like width and height in points.

Code to Change Picture Size in Word using C#

This code demonstrates how to resize image in Word document using C#. It uses DocumentBuilder.InsertImage() method to insert an image that takes the image file name and returns the reference to the image in the Shape class object. The Shape class object is used to set the width and height by providing the desired inches which are converted to points using the utility class ConvertUtil method InchToPoint().

This article has taught us how to resize picture in Word using C#. If you want to learn other processes like splitting a Word file into multiple files, refer to the article on how to split Word file using C#.

 English