word-2010

Office 2007 [and higher] interop: retrieve RGB-color

元气小坏坏 提交于 2019-12-19 10:47:08
问题 UPDATE: If you need to determine rgb-color in office document (format 2007) look at my answer below. Have: Interop.Word.dll ver.14 from VS2010 PIA, VS2010 Express Edition MS Word 2010 (ver.14) .docx-file made in mentioned Word manually without Interop. File contains several tables with colored corner cells. Purpose: To build another .docx-file with Interop contained those tables filled with gradient color based on colors in its corners. Where problem appears: I need to transform colors in

Sending text to Mail-Merge Fields in Microsoft Word 2010

坚强是说给别人听的谎言 提交于 2019-12-18 18:39:54
问题 I'm using the following code to send a text to a simple word template I've set up just with a single MergeField at present to test I can get this working. The code I am using is as follows: public static void ReplaceMailMergeField(string pWordDoc, string pMergeField, string pValue) { object docName = pWordDoc; object missing = Missing.Value; Word.MailMerge mailMerge; Word._Document doc; Word.Application app = new Word.Application(); app.Visible = false; doc = app.Documents.Open(ref docName,

Sending text to Mail-Merge Fields in Microsoft Word 2010

走远了吗. 提交于 2019-12-18 18:39:10
问题 I'm using the following code to send a text to a simple word template I've set up just with a single MergeField at present to test I can get this working. The code I am using is as follows: public static void ReplaceMailMergeField(string pWordDoc, string pMergeField, string pValue) { object docName = pWordDoc; object missing = Missing.Value; Word.MailMerge mailMerge; Word._Document doc; Word.Application app = new Word.Application(); app.Visible = false; doc = app.Documents.Open(ref docName,

How can I reliably get the number of pages in a Word document?

。_饼干妹妹 提交于 2019-12-18 13:06:37
问题 I am making lots of changes to a Word document using automation, and then running a VBA macro which - among other things - checks that the document is no more than a certain number of pages. I'm using ActiveDocument.Information(wdNumberOfPagesInDocument) to get the number of pages, but this method is returning an incorrect result. I think this is because Word has not yet updated the pagination of the document to reflect the changes that I've made. ActiveDocument.ComputeStatistics

Word 2010 Interop PDF Export missing border line

扶醉桌前 提交于 2019-12-12 14:06:25
问题 I have a strange issue ... I am using Word 2010 Interop, exporting a WordML document to PDF. There is a footer with top and bottom lines: <w:pBdr> <w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="auto"/> <w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="auto"/> </w:pBdr> After opening document I use doc.ExportAsFixedFormat( outputFileName.ToString(), exportFormat, openAfterExport, optimizeFor, range, 0, 0, item, includeDocProps, keepIRM,

Prevent actions to be added to the word undo redo OR Remove actions from the undo redo CommandBarComboBox

痴心易碎 提交于 2019-12-12 12:34:57
问题 We are inserting content controls programmatically in word document and we don't want to add actions to the undo stack of word. The only way that we found is to access the undo commandbar-combobox and to remove the items related to inserting content control action, we are using the code below : var commandBars = _wordDocument.CommandBars.Cast<CommandBar>(); var standardCommandBar = commandBars.First(bar => bar.Name.Equals("Standard")); CommandBarComboBox undoControl = standardCommandBar

Insert two fields in Word 2010 page header using VBA

孤者浪人 提交于 2019-12-11 02:47:28
问题 I am trying to insert two fields in a page header. I am able to insert them at the current selection (see code below), but I would prefer not having to select the page header before inserting the fields. Can this be done? Sub insertFields() Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="DOCPROPERTY LastSavedTime ", PreserveFormatting:=True Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="FileName", PreserveFormatting:=True End Sub 回答1: If you

Word 2010 combining INCLUDEPICTURE and IF

放肆的年华 提交于 2019-12-11 01:37:41
问题 Using MS Word 2010 I am trying to place an INCLUDEPICTURE field into a block of an IF statement. While both the IF statement and the INCLUDEPICTURE work correctly separate, they do not work in combination. IF Statement: { IF { MERGEFIELD condition \* MERGEFORMAT } = "expression" "true" "false" \* MERGEFORMAT } This works correctly. INCLUDEPICTURE: { INCLUDEPICTURE "picture.png" } This works correctly, too. Combination of the two: { IF { MERGEFIELD condition \* MERGEFORMAT } = "expression" "{

Remove paragraph mark from string

纵饮孤独 提交于 2019-12-06 23:49:42
问题 I have a macro that finds all of the 'Heading 1' styles within my document and lists them in a ComboBox on a UserForm. My problem is that the Find routine I am using is also selecting the paragraph mark ( ¶ ) after the text I wish to copy, and that is being displayed in the ComboBox. How can I remove this from the string? I've tried useing replace() , replacing vbCrLf , vbCr , vbLf , vbNewLine , ^p , v , Chr(244) and Asc(244) with "" , but nothing has succeeeded. For example - sanitizedText =

Is there a way to add custom web services to Word 2010 via the Research Pane?

◇◆丶佛笑我妖孽 提交于 2019-12-06 13:53:23
问题 I have been wondering if I can add custom web services with the wsdl or asmx file extension via the Research Pane in Microsoft Word 2010. I have searched just about every site that has those services, but no luck finding instructions. Rather than trial and error, I felt more confident if I were to ask someone here. Basically, what I would like to be able to do is add a site like http://www.ebi.ac.uk/Tools/webservices/wsdl or some other source and be able to send queries via the research pane.