Click here to Skip to main content
15,890,506 members
Everything / Productivity Apps and Services / Microsoft Office / Microsoft Word

Microsoft Word

MS-Word

Great Reads

by Mario Z
Pure .NET solution for performing find and replace text on Word documents (DOCX file format)
by koolprasad2003
This article explain you How to protect word document using C# and Word automation
by Reiss
This is an alternative for "How to Check Whether Word is Installed in the System or Not"
by koolprasad2003
This tip gives you an idea about how to create Word table using C# (Word automation)

Latest Articles

by William Damert
Console .NET application using Microsoft.Office.Interop.Word for keyword search
by stc.reseller
Helpful tips in labeling Office files or how to make Office file changes statistically visible, in one single step
by Jose A Pascoa
Although most Windows programmers have already used the RichEdit Control, many of them are not aware of all its capabilities. One such capability is image embedding.
by Member 12994860
Change the Font Color of all Equations in a Word Document

All Articles

Sort by Updated

Microsoft Word 

6 Apr 2011 by #realJSOP
You didn't provide the code you're using, so try this:DocumentClass m_Doc = (DocumentClass)m_App.Documents.Open(FileName: m_strTemplate);Or in VB.NET:Dim m_doc as documentclass = DirectCast(m_App.Documents.Open(FileName: m_strTemplate))EDIT ===========Corrected Dave...
6 Apr 2011 by #realJSOP
A little googling goes a long way. I searched for "embed word document in html page", and this was the first of 368,000 hits:http://labnol.blogspot.com/2007/03/how-to-embed-microsoft-office-or-pdf.html[^]
8 Apr 2011 by #realJSOP
"Macros" aren't available in .Net...
16 Jun 2011 by #realJSOP
I have a ap.net web that displays data 5 items at a time. I need to allow the user to print this data (without printing all the other crap on the page). My first thought was to use iSharpText to create a pdf file, but iSharpText has been problematic and there's no real (immediate) support for...
16 Jun 2011 by #realJSOP
I found "a way".Instead of creating a .DOC file, I create a .HTML file, and transfer it that way. At that point, the user can use IE to print it.
23 Jun 2011 by #realJSOP
Just save the html as a .doc file, and Word will open it. By the way, you want to use Response.WriteFile() versus Response.Write().
12 Aug 2011 by #realJSOP
You mean something like this Codeproject article does:Anagrams - A Word Game in C#[^]
12 Oct 2016 by #realJSOP
You're going to have to hook the keyboard events for the window. To do that in C#, you need to use the Windows API via Interop Services. The pinvoke.net website can help you find the appropriate API function prototypes and constants, but you'll have to do some digging on google to find out how...
27 Dec 2016 by #realJSOP
Here are the appropriate methids to use for conversion in both directions:System.Drawing.ColorTranslator.ToOLE(System.Drawing.Color)System.Drawing.ColorTranslator.FromOLE(int)
3 Jan 2017 by #realJSOP
Your table field (in the sql server database) has to be a NVARCHAR type.
22 Apr 2011 by 2000 P
Could some one help me for this problem?Thanks!//My requirement is : Inserting external objects in to the word and PPT document using C#. Inserting Menu should show all opened word and PPT documents. Here I am not able to get word's instance/document name. For PPT we can use ppApp = new...
24 Apr 2011 by 2000 P
Hi, Below given MS support solution is creating new insatnce on the fly and getting the instance name: http://support.microsoft.com/default.aspx?scid=kb;en-us;316126[^] using Word = Microsoft.Office.Interop.Word; Word.Application...
28 Apr 2011 by 2000 P
Hi, How to get no of running instances of word/PPT applications if different versions of MS office running?This code does not return all the insatnces if multiple versions documents opened.Please help.//for powerpoint instanceppApp = new...
28 Apr 2011 by 2000 P
Hi friends, Googled for some sample code which interact with different versions of MS office applications. Not able to find something helpful. I need to work with 2003, 2007, 2010 version of word and ppt. Could anybody help me to ive some resource on this. Specifically, getting specific...
3 May 2011 by 2000 P
HiIs there any option to cut (Not Copy!) a picture from the word document and paste it again? Sample code I found in the google only helped for Copy and paste.Could somebdy help me on this?Thanks:)
8 May 2011 by 2000 P
object oMissing = System.Reflection.Missing.Value;object oEoF = WdUnits.wdStory;wordApp.ActiveWindow.Selection.EndKey(ref oEoF, ref oMissing);
11 May 2011 by 2000 P
Hi I am facing problem while copying a shape from word(2007) document. How to copy a shape from word using bookmark? Could some one help me?This is what i am doing:object FileName = objTemplateFile;object oMissing = System.Reflection.Missing.Value; object oWhat...
12 May 2011 by 2000 P
Managed to somewhat like this and it will return all the running process:Process[] wordProcs = Process.GetProcessesByName("WINWORD");if (wordProcs.Length > 0){ foreach (Process wordProc in wordProcs) { if (wordProc.MainWindowTitle != "") { //Do...
7 Jun 2011 by 2000 P
Hi, Is there any good reference available for this kind of scenario? If multiple version of Word or PPT opened, code should able to handle the automation between the documents irrespective of their version. I tried interop assemblies which work with one version at a time. But in case...
2 Mar 2012 by _Q12_
I will give you an idea: If you really want to read only*.doc files, then my idea is of no good. But if you are undecided and want to read something formatted in a doc style, you can re-save the doc file in a *.docx which is basically an archive that you can unzip it, then search the file...
29 Jun 2014 by _Sahar
I am using the Microsoft Ax Framer Control to view the word document in the Visual C# Form. After Hosting(Open) the Word Document in the Ax Framer Control. While Right Click on the Word Document, Ms word Context Menu is Appearing. I Want to Hide this Pop up Menu. I...
25 Jun 2014 by _XeLo_
I have a VB.net application in WinFoms that can get the properties of cell in a word tables. The problem is it only gets the property of the cell and not the property per character.For example, the line below is in a single cell.The quick brown foxHow can I get the property of...
10 Sep 2014 by A.R.I.
I am working on a c# project (.Net 4.0) where we are extracting data from word file using microsoft's interop assembly. I have read bold, italic, underline etc. Now I want to read bullet list from word file. How can I do this using interop?
15 Apr 2019 by Aaron Queenan
It's a bit late to help the original poster, but in case anyone else finds this article, here's an explanation of the problem. Although other content controls support standard (MSXML3) XPath syntax, the repeating section content control only appears to support very simple XPath syntax, allowing...
10 Oct 2013 by AB-ishere
Hello my Seniors,I am beginner in the industry and has been given the task to create XSLT file from one of the clients Microsoft Word template and guess what I am struggling :-( I dont want to sound too demanding, but if you can guide me I will be able to get this done. I have...
15 Feb 2011 by Abdul Quader Mamun
Thank you for your question, in MS Word 2007.Use:Insert>>Table>> Excel Spreadsheet>>(use like excel function).=CONCATENATE("-4.3",B1)Result is -4.332 where b1 equals to 32=CONCATENATE("-4.3",B2)Result is -4.345 where b2 equals to 45=CONCATENATE("-4.3",B3)Result is -4.365 where b3...
11 Apr 2017 by abdul subhan mohammed
Dear All, I have an windows application, in which we are automating MS-OFFICE 2013/16. Now, we are trying to compare the Font Family, for that i want to create enum font family. Is there font family enum in WordInterop? What I have tried: Because the font names have space, so i got stuck...
22 May 2017 by abdul subhan mohammed
Dear All, I have created MsOffice Template application in windows using office interop in C#. I want to retrieve text from table_of_contents and indexes which are already in word document. MyCode: What I have tried: public static bool EvaluateTableOfContents(IQuestion question, string...
22 May 2017 by abdul subhan mohammed
I got the solution if(tableOfContents.Count > 0) { WordInterop.Range range = tableOfContents[_index].Range; if (range.Find.Execute(text)) result = true; } if (index.Count > 0) ...
11 Jul 2016 by Abhilash.J.A
Sir, I am trying to create a pie chart, then export to word using OpenXml in c#.net. But the problem is, 1) It is exporting but nothing shows ms word 2010 only. 2) I am using ASP.NET MVC4 project, there is a google pie chart which has around 1000 data by representing with multiple...
1 Apr 2011 by Abhinav S
Word is a standalone application - so no, this is not possible.
11 Apr 2011 by Abhinav S
Word does not have sheet names so you are basically on the wrong track at the moment.
22 May 2011 by Abhinav S
Try using interop classes for instantiation as shown here[^].
15 Jun 2011 by Abhinav S
Here[^]?
12 Aug 2011 by Abhinav S
See Using Word's spellchecker in C#[^].
12 Jul 2012 by Abhinav S
Your code looks quite ok.string str = (string)(MyRange.Cells[rCnt, cCnt] as Excel.Range).Value2.ToString();The exception is probably in the above line.Dont type case directly into string.Instead either use the null coalesce operator (??), use Convert.ToString() or directly check for...
3 Jun 2013 by Abhinav S
You can explore iTextSharp[^] for PDF editing.
30 Nov 2013 by Abhinav S
Try these links -http://msdn.microsoft.com/en-us/library/vstudio/cc442946.aspx[^]Writing a Word Add-in - Part I[^]
1 Jul 2015 by Abhinav S
These might help you -Read/ Write tags in PowerPoint using OpenXML in C#[^]Read and write Open XML files (MS Office 2007)[^]Read Excel as DataTable using OpenXML and C#[^]
12 Mar 2016 by aditya behara
Hi friends. I am creating an application which allows a user to open word within an C# application with WPF. Can you please help me with the code to open a word application within a group box. Thanks in advance.
18 Mar 2012 by Afnan_
Hello,,I am working on an Word 2007 add-in,I want this add-in to get the whole content of this active word document and convert it to array of bytes without saving the document in the filestream.I have succeeded in getting the text in this document and convert it to an array of bytes...
18 Dec 2014 by Afzaal Ahmad Zeeshan
Do give this one a try, Word Control for .NET[^]. It will preview the Word documents in a Win Forms application.
26 Feb 2012 by Ahmed Abu Aziz
Im seeking to make application that archiving word documents I face a problem in searching the content of those files on aspecefic text , so i decieded to insert the files in database , where each page will be arecord in atable have the name of the decument.i can read from the document file,...
23 Feb 2014 by Ahmed Bensaid
Take a look there ;)http://benjii.me/2014/01/download-an-asp-net-mvc-view-as-a-word-document/[^]
29 Jan 2014 by Ahmed Sa3d
HoW could I save data from microsoft word file into multiple fields in data base ??
1 Oct 2013 by Ahmed_Raza
some one tell me how can i convert a word document to pdf in sharepoint.?
20 Sep 2011 by ahsanriaz1K
Hi,Hoping well from your side.I want to insert a rich text formatting ribbon like Microsoft word ribbon to insert it in my Visual Studio windows application C# as well as ASP.net C# web app.Actually i want a rich formatting facility as given by MS word.I have heard that there is a...
20 Sep 2011 by ahsanriaz1K
Hi,Just read line by line and token it on space using arr = strtok(buffer,' ');check the correct syntax from internet.arr will have the words.
4 Dec 2014 by ajeemkurian
I have a word document and that document contains tables. after iterating tables and rows, i am getting "Content of a table cell" which is an OpenXml data.I need to convert that OpenXml data to html. OR How to create an word document using the OpenXml dataWhile i read entire word...
20 Sep 2011 by Ajit Hegde
HiIf you are using wpf then check these linkshttp://blogs.msdn.com/b/wpf/archive/2010/08/03/introducing-microsoft-ribbon-for-wpf.aspx[^]http://www.codeproject.com/KB/WPF/ribboncontrol.aspx[^]http://wpf.codeplex.com/wikipage?title=WPF%20Ribbon%20Preview[^]
27 Jul 2015 by Akbar Giffary
Case ("3. Surat Tugas")Dim path As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\LETTER\SURAT TUGAS.docx\"System.Diagnostics.Process.Start("explorer.exe", path)hi all, this is code what i've done before, it's works fine if the program installed on my local...
3 Oct 2011 by Al Moje
Hi,I think you could do it by Attachment on you smtp email...See this link if it could help....System.Net.Mail FAQRemember to vote if it help...Regards,Algem
13 May 2016 by Albert.Long
I am just a newbie in this file,But I don't know how to configure environment in vs2013, what shoud I do to import MSWORD.OLB??? Thanks!!!What I have tried:I Create a MFC project,and then use ClassWizard to chose that file.but there is many errors!!!why???
28 Apr 2012 by Aleonis
Hello! I`m trying to create a report system by using MSWord 2007, but i have problems with "Template replication".I have done the code part that opens template and creates a new document, but document is MESS - borders are erased, tables and captions are in completely different...
14 Sep 2016 by Alex Banu
this will end any MS Word, maybe this is a start :using System.Diagnostics;...Process[] word_apps= Process.GetProcessesByName("winword");foreach(var word_app in word_apps){ word_app.Kill();}
2 Dec 2013 by AlexDpars
This should be helpful for you.
24 Jun 2014 by Alexey Vlasenko
So I need to embed font to rtf document. But I've not found any examples how to do it. MS Word generates fileds and data like this.{\f230\fbidi \fdecor\fcharset0\fprq2{\*\panose...
26 Jun 2014 by Alexey Vlasenko
I used TTEmbedFont function from WinAPI to create embedded font data.
19 May 2015 by algor-AG
VBA : encrypted / password protected PDF for MS Office
9 Feb 2013 by Ali H. Othman
Hi Everyone,I have a requirement from which i need to programmatically create a word document from ASP.net application. Mainly the word document will have set of questions, each question should be followed by an empty content control "Textbox".The user is going to answer those...
5 Nov 2013 by ali majed
I created some HTML tables by PHP. every row in first table is link to another heading in the page . I created some HTML tables by PHP. every row in first table is link to another heading in page . like this.TablesNamescalName|others fieldheading1| Xheading2| Xheading3|...
9 Mar 2011 by Alimjan Yasin
I am working on word automation . our system requires open word file and read file content and translate it to another language , then save each content its places.I am thinking, word file includes pure text , table , and picture so on. how do I know the start position of table, picture as...
15 Mar 2011 by Alimjan Yasin
I am working on word application. My task is to read doc file's content and translate it to another language then save at exact postion in doc file.In short, translate content and don't change the format of doc file.Firstly, I read doc file, extracted sentences and saved it to List...
16 Mar 2011 by Alimjan Yasin
when replace the sentences ,we need to be carefull with ending position.start = WordDoc.Content.Sentences[index].Start;end = WordDoc.Content.Sentences[index].End;Range rng;rng = WordDoc.Range(ref start, ref end);rng.Text = text;rng.Select();it will replace sentences ending...
22 Mar 2011 by Alimjan Yasin
I want to replace text parts of Sentences. my approach isIterate on Sentences , since I use like this Document.Sentences.Count;then I replace then in two way.if Sentences is only includes text, I replace whole Sentences as belowRange rng = Sentences[i].Range(Start,End);rng.Text = str...
26 Jun 2011 by Alimjan Yasin
I used the replacing methods, since I don't know how to save the format of word file ,it is better to analys it at sentences level and replace every single sentences by its translation. one more reason is there is no avaiable solution for that perpouse.
29 Feb 2012 by Alister007
follow linkshttp://www.eggheadcafe.com/community/asp-net/17/10136951/display-word-document-in-aspnet-control.aspx[^]http://www.dotnetspider.com/forum/31319-display-word-document-web-browser-asp-net.aspx[^]
13 Aug 2012 by allav_arunlml
Hi All,I am developing an application in SSIS with C# as Code behind. My requirement is to generate MS Charts and save as Word Document in a shared path daily and send the path link as Email to Users on daily basis. Based on Certain data 'n' number of Word document needs to be generated. In...
4 Mar 2014 by Amalraj Ramesh
i think its a assembly issue make sure that Microsoft.Office.Interop.Word is there at pariticular servergoto this path and check it outC:\Windows\assembly
10 Mar 2014 by Amalraj Ramesh
Hi--I am finding that reports exported to Word cannot be opened in OpenOffice Writer 4."General Error. General input/output error."Is anyone else having this issue or have gotten it to work?
11 Mar 2014 by Amalraj Ramesh
Hi,I am try to read doc file using WordprocessingDocumentBut got an error like File contains corrupted data.My code string filepath = @"\\...116.27.DOC";WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(filepath , true);//error line here
27 Aug 2014 by AmiR1999
C++ Standard Library does not provide functionality for this job.But you can use an API(external library) to do this job.The APIs maybe free or not.If your project is commercial and you can spend much money on this,you can communicate with a company to do this(a company which has experience...
15 Nov 2015 by Amit Upadhyay
Dear Sir,I am developing a word addin for MS Word 2013. In this when the user open a new word document file and click on the addin, the custom task pane will get filled with the attributes of the table from the database in multi check box. After selecting the desired attributes, when user...
15 Oct 2014 by AmolPatil19787
Hi,I have one xml string I have created that using string some string functions.eg.
8 Nov 2019 by amrinde
you should use save as oDoc.SaveAs("MyFile.doc", ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
6 Feb 2018 by amsga
I am trying to build a small software to generate reports using the data I obtained from a database. One of my requirements was to draw charts based on the number of days selected. My initial testing was working fine for a short duration from 1 week's worth of data. When I shifted to upper...
22 Feb 2018 by amsga
Hi All, I am trying to hide Word and Excel from displaying when I am processing some documents. I know it is capable of not even being displayed on the taskbar but hidden as a process but I can't seem to get that to work. I am also not sure if creating excel tables or charts is causing this...
31 Jul 2019 by amsga
Hi, I am currently using Interop.Word to draw tables for a document. I am looking to draw only the outside border for a set of cells (e.g. R1C1 to R2C3) I roughly know how to draw a full outside border around one cell. I am hoping that I can just call something to draw the border around the...
5 Mar 2013 by Andreas Gieriet
docx is Office Open XML[^] format.So, this has not directly to do with general purpose zip, but rather with the way office stores the file.C# provides the package class[^] to process such files.Please note that a package only understands the form, not the content. I.e. if you want to...
10 Oct 2013 by Andreas Gieriet
How about:get/create a HTML version of your Template file firstcreate an XSLT file that produces that HTML template and add all the required xml data as ...create templates in XSLT to replace the preformatted data from above with nicely formatted dataThis assumes you have...
28 Dec 2011 by Andrew Piotrowski
Is there any Addin/Plugin for the Word 2010 ? I saw a template version for Word 2003 but i am looking for a better solution ?
15 Feb 2011 by Andrewpeter
I use MSWord to create a data table, I need add prefixes into data in it (on every column), e.g:Column 1:3245653457656545...I want to add prefixe "-4.3" in front of data on this column to receive it the following:Column 1 (after add...
5 Oct 2011 by André Kraak
As far as I understand the Find Interface[^] and Replacement Interface[^] you need to replace rng.Find.Format = true; with rng.Find.Format = false; and it should work.
19 Aug 2014 by Andy Bantly
Word can understand many data formats. Rich text format was mentioned. Write your data file as html file and create your own table markup containing your data. Word will read this without any trouble and display it.If you want to get really fancy crazy you can write an XSL processor in...
2 Mar 2012 by andy(-RKO)
Hello ,Can Any Body Tell Me Is It Possible To Convert File PDF To Word Using Open Office In C#.Net?and if Yes then how we implement that?Thanx In Advance..:-)
6 Mar 2012 by andy(-RKO)
Hello All,I Want To Convert Tiff File To Word Using Asp.net C#. Can Any One Help Me..Please Reply Me ASAP..Thanx In Advance
8 Mar 2012 by andy(-RKO)
Hello All,Can Any One Tell Me How Can We Convert PDF To Word Using Ghost Script..?Thanx IN Advance
8 Mar 2012 by andy(-RKO)
Hello There,A Question In My Mind Is It Possible to Convert Postscript(PS) File Into Word(doc) file using Asp.Net?If Yes then how can we resolve it via C# Code.Thanx In Advance
17 May 2012 by andy(-RKO)
Hello All,i have this issue using third party dll that is PDF Foucus Net.Thank You All
1 Mar 2012 by Andy1828
Does anybody know any algorithm for reading *.doc (1997 - 2003) files without using (opening) of Word ?
8 Mar 2012 by Aniket Yadav
check this, it may give u some ideaHow To Convert PDF to Image Using Ghostscript API[^]
22 Apr 2011 by Ankit Rajput
Hi,Please check itMicrosoft.Office.Interop.Word.Application objWord;objWord= (Microsoft.Office.Interop.Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");for (int i = 0; i
24 Apr 2011 by Ankit Rajput
HIPlease go through with this postRunning Instance of WordRegardsAnkit
2 Dec 2017 by annee a
What kind of programming language would be better/ easily to program Idea: As user after login, upload file (for example Word document) -> program change text formatting in Word document (formatting like font, font size, text colour). Different users this formatting could be different defined....
13 Mar 2014 by Anubhav689
Hey Bro,You need to use at starting of your Application i.e. tag should be congaing the Grid.Apply this at the starting of your application:-also don't forget to close this form at end of your Application.Your code will look like...
15 Oct 2016 by Anup Kumar Gupta
You can use Hooks for keypress event, to get the value of pressed key. It will be a generic WinForms Application and you would be able to get info of events on any open application(including MS Word). Visit these links, they will surely help you out.MSDN help page on HooksAn easy...
4 Jan 2018 by AnvilRanger
You can take a look at the Open XML SDK, Welcome to the Open XML SDK 2.5 for Office[^]
26 Oct 2015 by argeraju
Hi Experts,As per client requirement I want to display , edit the word document on the view and I want to save modified word document into the Database.1) I m displaying word document to HTML TextArea control after converting word document to HTML string using OPENXML DLL , I m able to...
5 Mar 2013 by arindamrudra
Can you please have a look at this link[^].