Hello Everyone,

Today i am going to show you how to edit Microsoft Word File using C# Step by Step.
So Lets Start !

First Step :- Create New Console Application Project and name it what ever you want.

step1

Second Step :- Now add Microsoft.Office.Interop.Word Reference.

step2

Third Step :- Now Create New or Open Your Microsoft Word Document File and Add some special name which can easy to Find and Replace.
In my case i want to edit First Name and Last Name so I will type this :-
<firstname>
<lastname>

step3

Fourth Step :- Now add this Code in your Program.cs File and Run the Program.
Code :- http://pastebin.com/BTVyHEQ5

Step4

Fifth Step :- Now Open your Microsoft Word File and see your edits 🙂

step5

Now you are done 🙂

Thanks,
Ch. Muhammad Osama

Categories: Tutorial

Choudhary Muhammad Osama

This is Choudhary Muhammad Osama, a highly accomplished Penetration Tester, Security Analyst and Linux Administration enthusiast, with extensive experience in implementing, maintaining, securing and pentesting web applications and networks.

1 Comment

Artem · December 28, 2022 at 5:45 pm

I dont have Microsoft.Office.Interop.Word. How to install it?

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.