Questions tagged [word-automation]

Word Automation is controlling Word using other programs without any human interaction.

This tag to be used for all the questions on usage of Word Object Model and automation of Word through other applications.

161 questions
11
votes
1 answer

Improve performance of Search Replace in Word document using OLE and Delphi

After some experiments I ended up with the following code to perform Search and Replace in MSWord. This code works perfectly also in header and footer, including the cases in which header and/or footer are different for the first page or odd/even…
UnDiUdin
  • 14,924
  • 39
  • 151
  • 249
9
votes
2 answers

OpenXML Add paragraph style (Heading1,Heading2, Head 3 Etc) to a word processing document

Can anybody guide me how to add predefined styles on paragraph using open XML Word Processing? I have tried various solutions available on forums but nothing works for me. Here is what i want to accomplish: // Create a document by supplying the…
Nabeel
  • 784
  • 3
  • 9
  • 23
8
votes
2 answers

Inserting text after a bookmark in openxml

I am looking for a way to insert some text after a bookmark in a word doc using openxml. So far, i have been able to locate the bookmark using the following: var bookmarks = mainPart.Document.Descendants().ToList(); var…
John Baum
  • 3,183
  • 11
  • 42
  • 90
8
votes
1 answer

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., needs to be…
AJ.
  • 16,368
  • 20
  • 95
  • 150
6
votes
4 answers

Word Automation - File is in use by another application or user

I have a WinForms application where I am using Word Automation to build documents via a template, and then save them to the database. After the document is created, I retrieve the document from the database, write it to the file system in a temp…
Brandon
  • 10,744
  • 18
  • 64
  • 97
6
votes
3 answers

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…
CowherPower
  • 315
  • 3
  • 11
6
votes
2 answers

Find a table in word and write in that table using java

I have a word document which may have n number of tables. The table is identified by the table name which is written in the 1st cell as heading. Now i have to find the table with table name and write in one of the cell of that table. I tried using…
gSr
  • 116
  • 2
  • 8
5
votes
2 answers

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…
zfeld75
5
votes
2 answers

Start Word and monitor if document closed

we need for our school project a way to start a word instance and track if the document was closed. The COM api from word doens't have a event for this, are there any other ways to do this? Currently we're using the COM api from word, but everything…
MBulli
  • 1,659
  • 2
  • 24
  • 36
5
votes
4 answers

Is it possible to generate .docx files without having MS Word installed?

I want to use "OLE automation" (or whatever it's called now) to generate a Word document. I assume that it's possible to perform the following programmatically: Set page size (height, width, margin vals) Set font type/name, style, and size Add page…
4
votes
1 answer

How to programmatically use Word's "Compare and Merge Documents..." functionality from C#?

Question Is it possible to call Word 2003's Tools > Compare and Merge Documents..." function from C# and to get feedback whether any differences were found or not? What I have found so far It is possible to call the functionality like this. But I…
Lernkurve
  • 20,203
  • 28
  • 86
  • 118
4
votes
1 answer

Adding multiple word tables into word using interop

I'm trying to insert multiple tables into a word document using c#, but when I add another block of code to add a table in I am getting an error and the second table is not being inserted. How do I move the range down to the bottom of the page and…
user1949280
  • 75
  • 2
  • 8
4
votes
1 answer

Word Automation Service breaks links in table of contents

I have written a code which utilizes Word Automation Service in order to convert the .DOCX file to the .PDF. I have noticed that in case the Word document contains a table of contents, its links are removed in the PDF. This is very bad for my…
Boris
  • 9,986
  • 34
  • 110
  • 147
3
votes
2 answers

Insert rtf text in a word document

I am using OLE Search Replace to replace "placeholder tags" with content stored in db fields into a Word docuemnt. I use a technique similar to what disussed here. THis works but of course it doesn't for rtf fields. I have db fields containing rtf…
UnDiUdin
  • 14,924
  • 39
  • 151
  • 249
3
votes
2 answers

How to execute Word Automation Services programmatically?

How to force execute/start of Word Automation Services programmatically? I need to start/execute once submit a conversion process. string siteUrl = "http://localhost"; string wordAutomationServiceName = "Word Automation Services"; using…
Ahmed Atia
  • 17,848
  • 25
  • 91
  • 133
1
2 3
10 11