office-interop

Word Spell Check pops up hidden and “freezes” my App

笑着哭i 提交于 2019-12-10 17:59:46
问题 I am using Word's Spell Check in my in house WinForm app. My clients are all XP machines with Office 2007 and randomly the spell check suggestion box pops up behind the App and makes everything "appear" frozen as you cannot get at it. Suggestions? What do other people do to work around this or stop it altogether? Thanks Below is my code, for reference. public class SpellCheckers { public string CheckSpelling(string text) { Word.Application app = new Word.Application(); object nullobj =

Can you install Office 2007 PIA's without office

一笑奈何 提交于 2019-12-10 17:23:40
问题 First of all, my question is not quite the same as Is Office 2007 PIA deployment possible without Office 2007? I am not looking to use the PIA's yet. The IT engineers would ideally like to deploy the 2007 PIA's to everyone's computers before they upgrade Office 2007. This way there is fewer things that have to go right all at once. I am wondering if this is possible 回答1: My best experience is deploing PIA with your application/add-in, because there are some awkward factors, which can be

Interop Excel not closing process

亡梦爱人 提交于 2019-12-10 17:23:23
问题 I have been struggling with this problem for a couple of days, I have made reasearch and applied all the suggestions I found on various forums but I'm still unable to solve it. My problem is with excel using interop library, I have an excel file used as template, so I am opening it and saving in a new location with a new name. Everything works great except that the Excel process keeps runing after the file is created and closed. This is my code protected string CreateExcel(string strProjectID

How do I get the *actual* host application instance?

回眸只為那壹抹淺笑 提交于 2019-12-10 17:16:51
问题 I have this code in a C# add-in for the VBE (emphasis "VBE": it's not a MS-Office add-in): public abstract class HostApplicationBase<TApplication> : IHostApplication where TApplication : class { protected readonly TApplication Application; protected HostApplicationBase(string applicationName) { Application = (TApplication)Marshal.GetActiveObject(applicationName + ".Application"); } Where TApplication is a MS-Office interop Application class, for example, a Microsoft.Office.Interop.Excel

Excel AddIn Click Once deployment issue

此生再无相见时 提交于 2019-12-10 16:54:51
问题 When I create a Excel 2010 Add-in project in Visual Studio 2010, and configure my prerequisite publish options for click once deployment, the 'Microsoft Visual Studio 2010 Tools for Office Runtime (x86 and x64) option item, has a warning indicator over the icon, which screen tip says "Prerequisite could not be found for bootstrapping". Once I try to publish, it publishes fine, however, I get the warning: "Item 'Microsoft.VSTORuntime.4.0' could not be located in 'C:\Program Files\Microsoft

Prevent Word document's fields from updating when opened

点点圈 提交于 2019-12-10 13:13:00
问题 I wrote a utility for another team that recursively goes through folders and converts the Word docs found to PDF by using Word Interop with C#. The problem we're having is that the documents were created with date fields that update to today's date before they get saved out. I found a method to disable updating fields before printing, but I need to prevent the fields from updating on open. Is that possible? I'd like to do the fix in C#, but if I have to do a Word macro, I can. 回答1: As

Cannot add reference to Outlook 2016 (Office 365) Interop (16.0.0.0)

主宰稳场 提交于 2019-12-10 13:02:31
问题 I'm trying to add a reference to 'Microsoft Outlook 16.0 Object Library' in a C# .NET 4.6.1 WPF project, because I have office 2016 installed. Previous versions of the Object Library are incompatible with the 2016 version of office. If I use Excel's VBA editor, 'Microsoft Outlook 16.0 Object Library' is listed, and exists in C:\Program Files\WindowsApps\Microsoft.Office.Desktop_16010.9126.2116.0_x86_8wekyb3d8bbwe\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\MSOUTL.OLB , as you can see

How to add text into Word Documents at a specific position?

血红的双手。 提交于 2019-12-10 12:48:14
问题 How do I write to a specific position in a Word document, for example, line 5, character 50? I have searched for a couple of hours, but couldn't find a solution. I am using Microsoft.Office.Interop.Word 回答1: If you are content with the more simple sentence, rather than lines: ActiveDocument.Sentences(1).Characters(5).Select Selection.Collapse Selection.InsertBefore "added " Five paragraphs and 50 spaces in VBA Selection.Text = String(5, vbCrLf) Selection.Collapse wdCollapseEnd Selection.Text

Delay when creating Microsoft.Office.Interop.Word.Application

孤人 提交于 2019-12-10 12:16:04
问题 I've got an (legacy VB.Net) application that pulls data from some tables, populates a word template, and concatenates that template with several other files. On several machines this works with no issues, but for one client there is a persistent problem where the Word Interop code throws Object reference not set to an instance of an object when attempting to open the template file (which exists, and has no permission issues, etc). Dim doc As Document Dim msWord As Microsoft.Office.Interop

Retrieving all Outlook messages in same thread

风流意气都作罢 提交于 2019-12-10 11:46:17
问题 We are building sort of Communication Management System atop Outlook. One of the important task we wish to achieve is to retrieve all the messages (.msg files??) in the same thread along with their attachments and put them in the same folder inside CMS's repository . The problem we are facing is how do we know programatically that particular message (or .msg file??) and attachment belongs to the particular thread. Say for a first message we create a folder in a repository. Then we want all