word-automation

How to read Microsoft Word documents in .NET? [closed]

大城市里の小女人 提交于 2021-02-11 12:18:15
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . How to read doc, docx file into .NET with C#. 回答1: I see you used the asp.net tag. You should not use the automation API (COM Interop) to run Microsoft Office products from ASP.NET or any other server application

C# Word Automation : Replace picture with Text

柔情痞子 提交于 2020-01-03 03:21:12
问题 I am programming a software and it requires images to be replaced with either images or text. I found some code to replace images with images it works fine. I want to tweak this code so that i can also replace images with text . I know there are better ways to do it but I specifically need it done using Interlope. Any help would be appreciated. using System.Collections.Generic; using Word = Microsoft.Office.Interop.Word; namespace WordExample { class WordExample { #region Constructor public

Microsoft Word Interop automation FilePrintSetup Error

北慕城南 提交于 2020-01-02 09:56:07
问题 I am getting "There is a printer error." when tying to send a print job to a printer using automation on Windows 7 with Word 2010. Same code works fine on Windows XP box with Word 2007. I am not sure if Windows 7 or word 2010 is causing the error. Any help appreciated using Microsoft.Office.Interop.Word; ..... object oWordbasic = wordDoc.Application.WordBasic; object[] argValues = new object[] { value, 1 }; //first arg is a printer name String[] argNames = new String[] { "Printer",

how to access programmatically to “print preview and print” page in Office Word 2010

血红的双手。 提交于 2019-12-24 05:57:10
问题 I am writing a medical program (with C# Language) which has a relation with Microsoft Office Word 2010. In Word 2010 there is a page "Print Preview and Print" which you can access by pressing Ctrl + P . After I launch Office Word, I want to see "Print Preview and Print" but instead I see the old print preview from Office 2007/2003, which means I don't know how to access this page from office com objects. The code I've tried: oWordDoc.PrintPreview(); _oWord.Visible = true; 回答1: You can always

Using Sharepoint Word Automation to do a text replace

北城以北 提交于 2019-12-19 11:28:47
问题 I am working with sharepoint 2010, what I am trying to do is take a word document template, do a replace on a few key words (ex: replace ##ClientID## with the id of the client) and save it with a specific name in a library on sharepoint. I have figured out how to do this on a local computer with word interop, however the word interop library is not designed to be run as a service. I then discovered Word Automation Services which appear to do what I need to do. However every example I find on

Server-side word automation

送分小仙女□ 提交于 2019-12-13 12:23:59
问题 I am looking for alternatives to using openxml for a server-side word automation project. Does anyone know any other ways that have features to let me manipulate word bookmarks and tables? 回答1: I am currently doing a project of developing a word automation project for my company and I am using DocX Very simple and straight forward API to work with. The approach I am using is, whenever I need to work with XML directly, this API has a property named "xml" in the Paragraph class which gives you

Adding multiple word tables into word using interop

≯℡__Kan透↙ 提交于 2019-12-12 11:34:38
问题 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 then add another table? I tried creating a new range using the end of doc reference but this doesn't seem to work, can anyone give me some help? Word._Application objApp; Word._Document objDoc; try { object objMiss = System.Reflection.Missing.Value;

Inserting text after a bookmark in openxml

青春壹個敷衍的年華 提交于 2019-12-12 08:00:12
问题 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<BookmarkStart>().ToList(); var bookMarkToWriteAfter = bookmarks.FirstOrDefault(bm => bm.Name == insertAfterBoomark.Name); This bookmark in the word doc is a selection of two lines in the doc. I have to insert some text right after the two line selection. I have tried to insert text using the

Get paragraph no where txt is found, and move text to end of paragraph using Word 2010 vba

北城余情 提交于 2019-12-11 13:59:25
问题 I am trying to use VBA to move a rich text clause ("strText"), which appears at the beginning of various paragraphs, to the end of each paragraph where the clause appears, and thereafter to underline strText. I am a novice/hobbyist at vba programming, so please be gentle. I spent a few days on this before seeking help. Problems with my attempted coding (which appears below): I tried to assign to var "LparaNo" the number of the paragraph wherein the found text (strText) appears. But the number

Word 2010 Templates/Addin/Document passing starting arguments

こ雲淡風輕ζ 提交于 2019-12-11 01:38:34
问题 I'm trying to create a word template or addin as a means to enter data into a form. It will be tied to a database through service calls. I'm wondering if there is a way to start this document by passing it an Id for the record it's tied to. I would like to open up the word document from another .NET program passing it the Id so it knows where to get its data. Is this possible? or am I looking at this all wrong? 回答1: I use Custom Document Properties to store lot of things about the document.