{"id":50,"date":"2014-11-24T17:16:11","date_gmt":"2014-11-24T12:16:11","guid":{"rendered":"http:\/\/www.chmosama.com\/blog\/?p=50"},"modified":"2017-12-24T15:14:47","modified_gmt":"2017-12-24T10:14:47","slug":"how-to-edit-ms-word-text-with-c-console-application","status":"publish","type":"post","link":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/","title":{"rendered":"How to Edit MS Word Text with C# Console Application"},"content":{"rendered":"<p>Hello Everyone,<\/p>\n<p>Today i am going to show you how to edit Microsoft Word File using C# Step by Step.<br \/>\nSo Lets Start !<\/p>\n<p>First Step :- Create New Console Application Project and name it what ever you want.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-55\" src=\"http:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png\" alt=\"step1\" width=\"958\" height=\"648\" srcset=\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png 958w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1-300x203.png 300w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1-768x519.png 768w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/p>\n<p>Second Step :- Now add Microsoft.Office.Interop.Word Reference.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54\" src=\"http:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step2.png\" alt=\"step2\" width=\"805\" height=\"548\" srcset=\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step2.png 805w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step2-300x204.png 300w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step2-768x523.png 768w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/p>\n<p>Third Step :- Now Create New or Open Your Microsoft Word Document File and Add some special name which can easy to Find and Replace.<br \/>\nIn my case i want to edit First Name and Last Name so I will type this :-<br \/>\n&lt;firstname&gt;<br \/>\n&lt;lastname&gt;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-53\" src=\"http:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step3-1024x228.png\" alt=\"step3\" width=\"525\" height=\"117\" srcset=\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step3-1024x228.png 1024w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step3-300x67.png 300w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step3-768x171.png 768w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step3.png 1600w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/p>\n<p>Fourth Step :- Now add this Code in your Program.cs File and Run the Program.<br \/>\nCode :-\u00a0<a href=\"http:\/\/pastebin.com\/BTVyHEQ5\" target=\"_blank\" rel=\"noopener\">http:\/\/pastebin.com\/BTVyHEQ5<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-52\" src=\"http:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/Step4.png\" alt=\"Step4\" width=\"891\" height=\"633\" srcset=\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/Step4.png 891w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/Step4-300x213.png 300w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/Step4-768x546.png 768w\" sizes=\"auto, (max-width: 891px) 100vw, 891px\" \/><\/p>\n<p>Fifth Step :- Now Open your Microsoft Word File and see your edits \ud83d\ude42<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-51\" src=\"http:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step5-1024x225.png\" alt=\"step5\" width=\"525\" height=\"115\" srcset=\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step5-1024x225.png 1024w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step5-300x66.png 300w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step5-768x168.png 768w, https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step5.png 1600w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/p>\n<p>Now you are done \ud83d\ude42<\/p>\n<p>Thanks,<br \/>\n<strong>Ch. Muhammad Osama<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. Second Step :- Now add Microsoft.Office.Interop.Word Reference. Third Step :- Now [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":55,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[23,24],"class_list":["post-50","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","tag-c","tag-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Edit MS Word Text with C# Console Application - Blog - Choudhary Muhammad Osama<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Edit MS Word Text with C# Console Application - Blog - Choudhary Muhammad Osama\" \/>\n<meta property=\"og:description\" content=\"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. Second Step :- Now add Microsoft.Office.Interop.Word Reference. Third Step :- Now [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Choudhary Muhammad Osama\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/chmosama\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/chmosama\" \/>\n<meta property=\"article:published_time\" content=\"2014-11-24T12:16:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-24T10:14:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"958\" \/>\n\t<meta property=\"og:image:height\" content=\"648\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Choudhary Muhammad Osama\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ChMuhammadOsama\" \/>\n<meta name=\"twitter:site\" content=\"@ChMuhammad\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Choudhary Muhammad Osama\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/\",\"url\":\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/\",\"name\":\"How to Edit MS Word Text with C# Console Application - Blog - Choudhary Muhammad Osama\",\"isPartOf\":{\"@id\":\"https:\/\/www.chmosama.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png\",\"datePublished\":\"2014-11-24T12:16:11+00:00\",\"dateModified\":\"2017-12-24T10:14:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.chmosama.com\/blog\/#\/schema\/person\/1e5073e7a2fb381ec0503b87b16ba4c7\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#primaryimage\",\"url\":\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png\",\"contentUrl\":\"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png\",\"width\":958,\"height\":648,\"caption\":\"step1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.chmosama.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Edit MS Word Text with C# Console Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.chmosama.com\/blog\/#website\",\"url\":\"https:\/\/www.chmosama.com\/blog\/\",\"name\":\"Blog - Choudhary Muhammad Osama\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.chmosama.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.chmosama.com\/blog\/#\/schema\/person\/1e5073e7a2fb381ec0503b87b16ba4c7\",\"name\":\"Choudhary Muhammad Osama\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.chmosama.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3d3ebe72135073f739b9d6cc1c93ea0a0f40e9393eb5305a78f0d70435ad2f6c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3d3ebe72135073f739b9d6cc1c93ea0a0f40e9393eb5305a78f0d70435ad2f6c?s=96&d=mm&r=g\",\"caption\":\"Choudhary Muhammad Osama\"},\"description\":\"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.\",\"sameAs\":[\"https:\/\/www.chmosama.com\",\"https:\/\/www.facebook.com\/chmosama\",\"https:\/\/x.com\/ChMuhammadOsama\"],\"url\":\"http:\/\/www.chmosama.com\/blog\/author\/chmosama\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Edit MS Word Text with C# Console Application - Blog - Choudhary Muhammad Osama","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/","og_locale":"en_US","og_type":"article","og_title":"How to Edit MS Word Text with C# Console Application - Blog - Choudhary Muhammad Osama","og_description":"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. Second Step :- Now add Microsoft.Office.Interop.Word Reference. Third Step :- Now [&hellip;]","og_url":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/","og_site_name":"Blog - Choudhary Muhammad Osama","article_publisher":"https:\/\/www.facebook.com\/chmosama","article_author":"https:\/\/www.facebook.com\/chmosama","article_published_time":"2014-11-24T12:16:11+00:00","article_modified_time":"2017-12-24T10:14:47+00:00","og_image":[{"width":958,"height":648,"url":"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png","type":"image\/png"}],"author":"Choudhary Muhammad Osama","twitter_card":"summary_large_image","twitter_creator":"@ChMuhammadOsama","twitter_site":"@ChMuhammad","twitter_misc":{"Written by":"Choudhary Muhammad Osama","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/","url":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/","name":"How to Edit MS Word Text with C# Console Application - Blog - Choudhary Muhammad Osama","isPartOf":{"@id":"https:\/\/www.chmosama.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#primaryimage"},"image":{"@id":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png","datePublished":"2014-11-24T12:16:11+00:00","dateModified":"2017-12-24T10:14:47+00:00","author":{"@id":"https:\/\/www.chmosama.com\/blog\/#\/schema\/person\/1e5073e7a2fb381ec0503b87b16ba4c7"},"breadcrumb":{"@id":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#primaryimage","url":"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png","contentUrl":"https:\/\/www.chmosama.com\/blog\/wp-content\/uploads\/2017\/08\/step1.png","width":958,"height":648,"caption":"step1"},{"@type":"BreadcrumbList","@id":"https:\/\/www.chmosama.com\/blog\/how-to-edit-ms-word-text-with-c-console-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.chmosama.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Edit MS Word Text with C# Console Application"}]},{"@type":"WebSite","@id":"https:\/\/www.chmosama.com\/blog\/#website","url":"https:\/\/www.chmosama.com\/blog\/","name":"Blog - Choudhary Muhammad Osama","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.chmosama.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.chmosama.com\/blog\/#\/schema\/person\/1e5073e7a2fb381ec0503b87b16ba4c7","name":"Choudhary Muhammad Osama","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.chmosama.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3d3ebe72135073f739b9d6cc1c93ea0a0f40e9393eb5305a78f0d70435ad2f6c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3d3ebe72135073f739b9d6cc1c93ea0a0f40e9393eb5305a78f0d70435ad2f6c?s=96&d=mm&r=g","caption":"Choudhary Muhammad Osama"},"description":"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.","sameAs":["https:\/\/www.chmosama.com","https:\/\/www.facebook.com\/chmosama","https:\/\/x.com\/ChMuhammadOsama"],"url":"http:\/\/www.chmosama.com\/blog\/author\/chmosama\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":1,"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":56,"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions\/56"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/media\/55"}],"wp:attachment":[{"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chmosama.com\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}