This program automates the process of replacing images in Word documents with a specified image. It utilizes the Microsoft Office Interop library to manipulate Word documents.
The program performs the following tasks:
- Opens each Word document in a specified folder.
- Searches for inline images within the document.
- Replaces each inline image with a specified image.
- Saves the modified document.
- Microsoft Office must be installed on the system.
- The Word documents must be in the .doc or .docx format.
- Rerference to Microsoft.office.interop.word
-
Clone the Repository\Download: Clone\Download the repository containing the program files.
-
Build the Program: Build the program using Visual Studio or any compatible C# compiler.
-
Set Image and Folder Paths: Update the
imagePath
andfolderPath
variables in theProgram.cs
file with the paths to your image and folder containing Word documents. -
Run the Program: Execute the program. It will process each Word document in the specified folder, replacing inline images with the specified image.
- The program may not pick up some images if the "Warp Text" format of the image is not set to "In line with Text" in the original Word document. If you need to replace images with a different format. I recommend using Spire.doc library.