word-field

Filling Word template fields with C#

谁都会走 提交于 2019-12-05 16:09:36
Currently, if I create a Word Document Template with fields, and then fill them using C#, I do it similar to this... object missing = Type.Missing; Word.Application app = new Word.Application(); Word.Document doc = app.Documents.Open("file.doc", ref missing, true); Word.FormFields fields = doc.FormFields; fields[2].Result = "foo" fields[3].Result = "bar" Is there a better way to reference the fields? I notice when creating the template I can add a Title and a Tag to the field, but I haven't found a way to reference those properties. It would be nice to be able to name fields and reference them

Parent file address, in embedded word doc fields is absoluted

旧城冷巷雨未停 提交于 2019-12-04 02:33:25
问题 How can made it relative? I have "WB1.xlsm" in "E:\Administration\Salary" . A word document was embedded in Sheet1 : (Microsoft Word Macro-Enabled Document object) I did Copy & Paste Cells(2,1) in the embedded word doc as Paste Special > Paste Link There is an absolute parent file address have generated in the field's code: LINK Excel.SheetMacroEnabled.12 "E:\Administration\Salary\\WB1.xlsm" "Sheet1!R2C1" \a \f 4 \r \* MERGEFORMAT So I can't move the Excel file. How can make the parent file

Parent file address, in embedded word doc fields is absoluted

旧时模样 提交于 2019-12-01 14:19:05
How can made it relative? I have "WB1.xlsm" in "E:\Administration\Salary" . A word document was embedded in Sheet1 : (Microsoft Word Macro-Enabled Document object) I did Copy & Paste Cells(2,1) in the embedded word doc as Paste Special > Paste Link There is an absolute parent file address have generated in the field's code: LINK Excel.SheetMacroEnabled.12 "E:\Administration\Salary\\WB1.xlsm" "Sheet1!R2C1" \a \f 4 \r \* MERGEFORMAT So I can't move the Excel file. How can make the parent file address which is in linked fields, related to the application.path of parent document? parent document

Calculation fields not working with dates

两盒软妹~` 提交于 2019-12-01 13:30:30
I have seen quite a lot of examples looking for a solution, so I'm pretty certain that this possible. I have Custom Document Properties (properly defined as date) containing dates , and I want to make operations on them : {={ DOCPROPERTY DateFieldTest }+1 \@"d MMMM YYYY"} 'toggle DOCPROPERTY Field {=07/04/2016+1 \@"d MMMM YYYY"} 'toggle calculation field 1 I have also tried : {=DATE(YEAR({ DOCPROPERTY DateFieldTest }),MONTH({ DOCPROPERTY DateFieldTest }),DAY({ DOCPROPERTY DateFieldTest })+1) \@"d MMMM YYYY"} 'toggle DOCPROPERTY Field {=DATE(YEAR(07/04/2016),MONTH(07/04/2016),DAY(07/04/2016)+1)

How do we add field code for Word using word javascript api

大城市里の小女人 提交于 2019-12-01 11:13:33
I want to add field code using word JavaScript API. I checked the API documentation but I found nothing regarding this. Is there a way to do it in this API? There is no direct support in the API for adding fields, i.e. you will have to create Open XML containing the field. You can then insert this Open XML in your document (something a long the lines of the following untested snippet): // Run a batch operation against the Word object model. Word.run(function (context) { // Queue a command to get the current selection and then // create a proxy range object with the results. var range = context