office-interop

The Microsoft.Office.Interop.Word assembly version is higher than referenced

早过忘川 提交于 2019-12-07 04:08:30
问题 What is the cause of the following error: Error 12 Assembly 'Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' uses 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' c:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Word.dll

Add watermark image in c#

廉价感情. 提交于 2019-12-07 00:43:29
I have this little code to add a watermark image in a doc file, only have a little issue, if i convert it one time it works ok, but if i try to convert another file gives me this error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) in this line: wordFile = oWord.Documents.Open(row.filename); This is my code: Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application(); Document wordFile = new Document(); //OTHER VARIABLES Object oClassType = "Word.Document.8"; Object oTrue = true; Object oFalse = false; Object oMissing = System

`EOleException: Call was rejected by callee` while iterating through `Office.Interop.Word.Documents`

百般思念 提交于 2019-12-06 19:53:24
I've been working with Word2010.pas for the past week and everything went well, until I found out that if you open a document manually , edit it (but don't save), press Alt+F4 , a prompt will show up saying if you want to save your document or not, leave it like that. Go into code and try to access that document , all calls will result in EOleException: Call was rejected by callee . Once you cancel that Word save prompt, everything works fine. I came across this while writing code that periodically checks if a document is open. Here is the function that checks if the document is open: (

How to connect to outlook 2010 while its running in c#?

无人久伴 提交于 2019-12-06 19:05:02
问题 What I am trying to do is add an "Email To..." button to a winform client that opens a new outlook mail window and attaches a file so the user can forward it. I can get the outlook integration working just fine if outlook is not already running. This is a C# .NET 4.0 winforms app, using the Outlook 14.0 interop library, against Outlook 2010 32 bit running on windows 7 64 bit machine. I have the app already compiled to x86 for other reasons so I doubt its a 32/64 bit issue. Here is my code: //

Get Data From .docx file like one big String in C#

﹥>﹥吖頭↗ 提交于 2019-12-06 17:04:22
问题 I want to read data - like string, from .docx file from C# code. I look through some of the issues but didn't understand which one to use. I'm trying to use ApplicationClass Application = new ApplicationClass(); but I get t Error: The type 'Microsoft.Office.Interop.Word.ApplicationClass' has no constructors defined And I want to get full text from my docx file, NOT SEPARATED WORDS ! foreach (FileInfo f in docFiles) { Application wo = new Application(); object nullobj = Missing.Value; object

How to show an Office/Word 2013 Task Pane 'Office App' after a click on a button in Ribbon?

自作多情 提交于 2019-12-06 11:48:46
I've created a Task Pane App with the new Office App model. It uses JQuery and a REST Service to search and display data from SharePoint in the (Word 2013) Task Pane. This works ok, however the App Task Pane should be activated after clicking on a custom button in the ribbon. To create the button, I've created a Word 2013 Addin project with following Custom UI XML: <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"> <ribbon> <tabs> <tab idMso="TabHome"> <group id="ContentGroup" label="SharePoint App"> <button id="spAppButton" label="SharePoint App"

Interop.Word Find and Hyperlink that word

好久不见. 提交于 2019-12-06 10:50:32
I am trying to create a program which searches in a Word doc for a certain word and adds a hyperlink to that word. I can do the code to search for the word (using a FindandReplace ), and can work out how to add a hyperlink to a word doc, but I cannot work out how to hyperlink the word I searched for. I think its because I need to define the word I searched for as a Range. My code so far is: using System; using Microsoft.Office.Interop.Word; using Word = Microsoft.Office.Interop.Word; using Color = Microsoft.Office.Interop.Word.WdColor; ... private void button2_Click(object sender, EventArgs e)

how to detect Empty paragraph in Word Document using Microsoft.Office.Interop.Word in C#4.0?

蓝咒 提交于 2019-12-06 10:48:50
问题 I want to detect Empty paragraphs in Word Document using Microsoft.Office.Interop.Word. Suppose, if my word document have some empty paragraphs,then Assume paragraph 3 is an empty paragraph... Microsoft.Office.Interop.Word.Paragraph para = wordDoc.Content.Paragraphs[3]; int cSent = para.Range.Sentences.Count; for (int j = 1; j <= cSent; j++) { Microsoft.Office.Interop.Word.Range sent = para.Range.Sentences[j]; MessageBox.Show("Sent lines :" + sent.Text.ToString()); } Then empty paragraphs has

How to connect to a running instance of outlook from C# [duplicate]

筅森魡賤 提交于 2019-12-06 08:09:39
问题 This question already has answers here : Getting/Creating an Outlook Application in Windows 7 (5 answers) Closed 6 years ago . In VBA, I usually use appOutlook = GetObject(, "Outlook.Application") to get a running instance of Outlook, and it throws an error if Outlook isn't running. I normally did this in excel, but now I am wanting to see if I can get better results by moving to C# and doing it from there. What I need to do is copy emails from outlook and paste them into excel so that the

Checking Font Styles In Word Document Using VB.NET

回眸只為那壹抹淺笑 提交于 2019-12-06 03:32:26
i want to check a word file using vb.net and check that the styles in the document are proper or not. I have to check for these expressions in word document a.Verdana + 16 pt + Bold + Red b.Verdana + 12 pt + Bold + Italic + Blue c.Verdana + 11 pt + Bold + Italic + Brown d.Arial + 10 pt + Black I have tried this, If objDoc.Range.Font.Name = "Arial" And objDoc.Range.Font.Size = 10 Then If objDoc.Range.Font.Color = WdColor.wdColorBlack Then End If MsgBox("ok") Else MsgBox("not ok") End If But with this code it shows msgbox "OK" only when the whole word document consist of Arial,10,Black and shows