office-interop

Making binding redirects work for office add-ins

拥有回忆 提交于 2019-12-23 10:49:31
问题 I'm using Microsoft.Bcl.Async in my Word addin, my addin is compiled as an exe (test_addin.exe) file, that is loaded as an assembly from Microsoft Word, when I start the executable directly, everything's working fine, but when I run it from Word, I'm getting an error saying that it failed to load the Systems.Threading.Tasks assembly. Could not load file or assembly System.Threading.Tasks... It looks like that its related to the binding redirects, when I try to run the application from Word it

How can I focus on a Word document I just opened through interop?

為{幸葍}努か 提交于 2019-12-23 09:59:03
问题 I am writing a simple Word Interop application which open a .doc file in background, changes bookmarks content, then make it visible to the user : var App = new Microsoft.Office.Interop.Word.Application(); var ParTemplate = (object)Template; var ParVisible = (object)false; var Doc = App.Documents.Open( FileName: ref ParTemplate, // Template ConfirmConversions: ref missing, ReadOnly: ref missing, ... Doc.Activate(); Doc.SetBookmarkValue("IssueNumber", TheIssue.IssueNo); Doc.SetBookmarkValue(

What is the difference between Microsoft.Office.Interop.* version 12 and 14?

三世轮回 提交于 2019-12-23 09:09:17
问题 I have installed Visual Studio 2010 and Office 2007. When I go to "Add Reference" and search for " Office Interop " I can see that each of the references appear twice with versions 12 and 14. I initially tried version 14 of Microsoft.Office.Interop.Word and did a quick test. Initialise the Application, open a Document, close the Document, quit the Application, and release the COM object. My test was a simple WinForms program in C# 4.0. WINWORD.EXE crashed while closing the document. I

Importing Excel Charts from Excel to PowerPoint causes `RPC_E_SERVERFAULT` on some machines

本小妞迷上赌 提交于 2019-12-23 04:57:08
问题 This is an irritating one. I have created a method to copy all Excel charts in a workbook to PowerPoint slides. public int ImportExcelChartsFromWorkbookToSlides(int startingSlideIndex, string workbookPath, string[] slideTitles, int chartPosTop, int chartPosLeft = 10, int titleWidth = 680, int titleHeight = 20, int titlePosTop = 90, int titlePosLeft = 20, int titleFontSize = 18) { int slideIndex = startingSlideIndex; int titleIndex = 0; EXCL.Application objExclApp = new EXCL.Application();

'The RPC server is unavailable.' when looping through word documents

一笑奈何 提交于 2019-12-23 03:26:05
问题 I am working on a utility to find and update DOC VARIABLES in Word. I have a section of code to loop through the documents and present a Message Box with the variable name, but I'm receiving an error when it tries to open the next document. The error is: System.Runtime.InteropServices.COMException: 'The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) I'm confused because my code does not access any network. I think what might be happening is the Word is closing when the

Translate VBA syntax to Matlab for Activex control of Word document

做~自己de王妃 提交于 2019-12-23 01:52:09
问题 I am a newbie to using activex controls in matlab. Am trying to control a word document. I need help translating between VBA syntax and Matlab, I think. How would one code the following in matlab? Sub macro() With CaptionLabels("Table") .NumberStyle = wdCaptionNumberStyleArabic .IncludeChapterNumber = True .ChapterStyleLevel = 1 .Separator = wdSeparatorHyphen End With Selection.InsertCaption Label:="Table", TitleAutoText:="", Title:="", _ Position:=wdCaptionPositionAbove, ExcludeLabel:=0 End

Blank page removal in a word document using microsoft word.interop

吃可爱长大的小学妹 提交于 2019-12-22 13:50:15
问题 I have created a word document which generates dynamic contents using word.interop . It has some page breaks used in between. what is the problem which I am facing is, this page breaks creates blank pages which I don't want to show to users. In some cases I need those page breaks there in order to maintain the page layout, so I can't think about removing those page breaks. but what I want is another solution like, in case if there no contents in a particular page other than a page break,

Print Word document from WPF with print settings (Aspose generated)

我的梦境 提交于 2019-12-22 11:29:03
问题 I've been fighting with a printing issue for a long time now, hopefully someone can help. Background I'm creating an Aspose.Words-document from a word-template, and mail merging it, and then want to print it directly from the WPF application with a print dialog. When printing i need to be able to select all different printer settings available for my printer (what paper to use, zoom, orientation, color etc.). This last thing seems to be what keeps my Google searches from succeeding, as all

Interop.Word print preview dialog for office 2010/2013

一笑奈何 提交于 2019-12-22 10:46:03
问题 In my application I have word template with tags which are later replaced using interop.word (find/replace) and then sent to print using print preview dialog: Interop.Word.Application.Dialogs[WdWordDialog.wdDialogFilePrint] On a result of a dialog I am printing or closing the document. For office 2003 and 2007 this is working absolutely fine, but in office 2010 later print preview dialog is absolutely different. I've found related post here but I need to grab dialog result so that i could

Can Microsoft.office.interop.word.dll work without installing office?

雨燕双飞 提交于 2019-12-22 07:00:10
问题 My ASP.Net-C# application works with mailmerge and the dll by name Microsoft.Office.Interop.Word.dll V14.0.0.0. All is well on my desktop (where office is installed). However when this application is deployed on the production machine, the following error is thrown: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception