office-interop

Does Office Starter include the DLLs for Microsoft.Office.Interop?

送分小仙女□ 提交于 2019-12-02 06:50:44
问题 I want to use Microsoft.Office.Interop.Excel to pull some data out of an XLS file. I have Visual Studio 2010 and the Office Developer Tools installed. However, I am getting a COMException error at var app = new Application(); when the program runs. Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). I have Office Starter 2010

Excel Automation Windows Service

自古美人都是妖i 提交于 2019-12-02 06:22:13
问题 I have a Windows Service that runs the Excel Interop in order to automate the execution of various macros. However, I am running in a peculiar issue when I try to run a macro which access a database using Windows Authentication ... If the macro is run through the Windows Service , the workbook is opened and the macro is execution is started but the application hangs (presumably at the data access portion). If, however, the macro is run through the Visual Studio debugger , using the same

Error when trying to open PowerPoint programmatically

只谈情不闲聊 提交于 2019-12-02 04:41:21
问题 I have a method that uses Microsoft.Office.Interop.PowerPoint.Application interface to convert PowerPoint presentation slides into a jpeg files. In a service application that runs on Windows 2008 server it works without any issues. Now however, I'm writing a new web application that uses the same process and the degubber chokes on the Presentation.Open call wiht an error: "PowerPoint could not open file". My environment is Win 7, VS 2010. I'm using impersonation with a domain account that has

How to get text from line number in MS Word

我的梦境 提交于 2019-12-02 03:54:51
问题 Is it possible to get text (line or sentence) from a given line number in MS Word using office automation? I mean its ok if I can get either the text in the given line number or the sentence(s) itself which is a part of that line. I am not providing any code because I have absolutely no clue how an MS Word is read using office automation. I can go about opening the file like this: var wordApp = new ApplicationClass(); wordApp.Visible = false; object file = path; object misValue= Type.Missing;

Enum values for Office interop via dynamic object

南楼画角 提交于 2019-12-02 03:29:09
问题 I am using COM interop for Word automation within my Silverlight-Ouf-Of-Browser application. This means that I can't reference COM directly but instead I rely on dynamic. Now I would like to call the following method: Range.Collapse(WdCollapseDirection direction). How do I find out what values are mapped to the individual enum values (e.g.does wdCollapseEnd have a value of 1 or 2)? Kind regards! PS: For further info on the method signature see http://msdn.microsoft.com/de-de/library/microsoft

Accessing a table by name in Word using c#

廉价感情. 提交于 2019-12-02 02:49:46
问题 I have a document containing lots of tables. I want to modify those tables using C# and Microsoft.Office.Interop.Word. I read that I can iterate trough all tables using the Tables interface. Question: is it possible to give the table a name/ID and access the table by its name? (like with shapes in Powerpoint automation). Question 2: If it's not possible with Microsoft.Office.Interop.Word, do the alternatives like Aspose Words offer a more convenient way? 回答1: is it possible to give the table

Error when trying to open PowerPoint programmatically

☆樱花仙子☆ 提交于 2019-12-02 02:37:00
I have a method that uses Microsoft.Office.Interop.PowerPoint.Application interface to convert PowerPoint presentation slides into a jpeg files. In a service application that runs on Windows 2008 server it works without any issues. Now however, I'm writing a new web application that uses the same process and the degubber chokes on the Presentation.Open call wiht an error: "PowerPoint could not open file". My environment is Win 7, VS 2010. I'm using impersonation with a domain account that has admin privileges. The PowePoint file I'm trying to open is in the c:\temp folder which has NTFS rights

Enum values for Office interop via dynamic object

亡梦爱人 提交于 2019-12-02 02:25:13
I am using COM interop for Word automation within my Silverlight-Ouf-Of-Browser application. This means that I can't reference COM directly but instead I rely on dynamic. Now I would like to call the following method: Range.Collapse(WdCollapseDirection direction). How do I find out what values are mapped to the individual enum values (e.g.does wdCollapseEnd have a value of 1 or 2)? Kind regards! PS: For further info on the method signature see http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.range.collapse Tools like Reflector make that fairly simple. You could even use

Programmatically encrypt Outlook email using Inspector

旧时模样 提交于 2019-12-02 02:21:23
I'm using C# with Outlook Object Model (Redemption is not an option for me due to licensing) and I'm having difficulty programmatically encrypting an email message before sending it. I can successfully get a reference to the CommandBarButton which supposedly represents the Encrypt button (Id 718 according to online examples), but I cannot programmatically depress it. I tried using both the CommandBarButton Execute() method and using SendKeys (not sure if sendkeys is even valid in this context). All debug.writeline statements show that the button is in the msoButtonUp state. I've been playing

Microsoft Interop saveAs command failed

空扰寡人 提交于 2019-12-02 02:16:59
I have this simple console app that converts Word documents to PDF using Microsoft Office Interop API. For some reason, this one document always fails and I have attached it and removed all extraneous content: click here For some reason, it works fine when you open the document and perform the saveAs function in Word, but through code, it fails. I've tried SaveAs2, SaveAs and ExportAsFixedFormat methods. I'm running Office 2010 and using Microsoft Word 14.0 Object Library. Thanks. My C# code is as follows Object missing = Type.Missing; String file = @"C:\Test\bad2.doc"; Word.Application