word-automation

C# Word spell check runs slow on Word 2007/Vista

Hello I have written a DLL that uses MS Word to spell check the content of a RichtextBox. The project uses Microsoft Word 11.0 Object Library. I have read that you can use that reference on machines using that version of Word or later, and that seem to be true. However ... When I run the dll in a test app on a machine with Windows Vis...

Automating Word Mailmerge not working as expected

I'm having a problem with some mail merge code that is supposed to produce letters within our application. I'm aware that this code is a bit rough at the moment, but we're in the "Get something working" phase before we tidy it up. Now the way this is supposed to work, and the way it works when we do it manually, is we have a file (the f...

Programmatically printing directory of word documents... last file always skipped.

I am having a problem when trying to programmatically print a directory of word documents. In this example, I am trying to print only the files with the "3_" prefix. The problem is that the file does not print unless there are two files with the 3_ prefix. I have been looking around forever to figure this problem out. Is there someth...

Office Primary Interop Assemblies not working after installing 2007 compatibility pack

I had a C# program that did some Word & Excel automation and it used Office 2003 Primary Interop Assemblies. The way I deployed it was by including the Interops in the bin and I had my program reference it from there as opposed to referencing it from the GAC (not very professional, but it worked fpr years). Recently on 3 machines the off...

range : apply formatting to a sub section in the range.

I'm writing a piece of code in c# to generate a report in microsft word document. I have a table of wid 2 columns. I select the 2nd column by oMainTable.Cell(currentRowNumber, 2).Range Every time I have to write something in that cell I use the above code with the combination of the Text property ,InsertParagraph(),InsertAfter() etc ...

Split documents in Word 2007

I have a couple of word documents and want to refer to and view specific sections of these. I thought about splitting the sections into seperate documents and then just viewing the correct files but is it possible to do it a nicer way? I thought about command-line switches for scrolling down to the correct chapter but haven't found any...

Options for automating Microsoft Word 2007 document creation

I have automated word document creation from templates using the "Microsoft Word 12.0 Object Library" in my project, but it is unacceptably slow. I'm looking for alternatives: I need to create a document from a template, run some macros and insert text and tables into various bookmark ranges (some text formatting options would be nice to...

Word 2007 Application.ActivePrinter does not get set when default printer is a network printer.

I am trying to use some Word 2007 automation where we give the user the ability to select a printer to print to and compile a word document. We give the ability to print locally or on a network printer. Network printers are specified in the code by their fully qualified path (printername + port if there is one). The problem is in Window...

2008 Datacenter Word Automation issue

We have an application that uses word automation. It works fine under Windows XP, but does not work on our Windows Server 2008 64-bit virtual machine running on VMware ESX unless it is running as the domain administrator. Under any other account (including a local admin), Word starts, uses a lot of CPU for 40 seconds when opening a doc...

Using Interop.Word, is there a way to do a replace (using Find.Execute) and keep the original text's justification?

I'm attempting to write find/replace code for Word documents using Word Automation through Interop.Word (11.0). My documents all have various fields (that don't show up in Document.Fields) that are surrounded with brackets, eg., <DATE> needs to be replaced with DateTime.Now.Format("MM/dd/yyyy"). The find/replace works fine. However, s...

inserting selected page from one word document in another word document with c#

I have a requirement to move selected pages from word DocumentA into another word DocumentB. So in the end DocumentB should have its own contents plus selected pages from DocumentA inserted at selected pages in DocumentB. The page number in DocumentB I will set thru properties. This is the code I am using to just append contents of Docu...

word automation problem

I am trying open a word document for manipulation. However in the code below 'wordApp.Selection' is always null object missing = System.Reflection.Missing.Value; Word._Application wordApp = new Word.Application(); Word._Document aDoc =wordApp.Documents.Open(ref fPath1, ref missing, ref readOnly, ref missing, ref missing, ref missing, r...

How can I programmatically bring up the document properties window in Word and go to the Summary tab?

I am developing a VB6 COM add-in for Microsoft Word and I have added a button to the Ribbon which will save the document to a database. But before the document is saved, I want to take the user to the document properties window so they can fill in the properties for the document (like Title, Subject and Author). I am using the followin...

How do I convert Word files to PDF using Word 2007 programmatically?

I used to convert Word documents to PDF via Word Automation: Enumerate the CommandBars until one containing "PDFmaker" was found, enumerating its controls and executing it. With Word 2007 this no longer works - although the PdfMaker Com Addin is installed and accessible via the Acrobat menu. PDFmaker is required for quality reasons. T...

Word automation: Find text inside autoshapes

When I use the "Find" function, it fails to find the words which are inside an autoshape. bool ret = vk_word_app.Selection.Find.Execute(ref vk_find, ref vk_false, ref vk_false, ref vk_false, ref vk_false, ref vk_false, ref vk_true, ref vk_num, ref varMissing, ref varMissing, ref vk_dynamic, ref vk_false, re...

Can SharePoint 2010 Word Automation Services worker process have a frequency of less than 1 minute?

I'm considering using the Word Automation Services feature of SharePoint 2010 for a project. I will be converting single documents and my users will be waiting on the conversion so it needs to be as close to realtime as possible. The worse case of my users having to wait 1 minute before their document conversion is even started by the ...

Error automating Word on Test Server

I am trying to open a Word document from a .Net web application. The code (in brief) contains ... using Word = Microsoft.Office.Interop.Word; using System.Reflection; and, the code that actually creates the document includes: object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = "\\endofdoc"; // \endofdoc is a predefi...