mailmerge

Mail Merge (Excel to Word) using C#

无人久伴 提交于 2019-12-23 01:18:06
问题 I was wondering if anybody knew how to do a mail merge using an Excel file as a datasource, to fill in fields on a Word template? I wish to use the interop for Word if i could...but am having a few difficulties finding code for this. Does anybody have any syntax for this? Thank you in advance. 回答1: A very useful method for learning how to automate specific actions in MS Word is to actually perform the action manually with 'Record Macro' enabled. Once you have the VBA macro its easy enough to

Add Variable Hyperlink in Mail Merge in Word 2013

自作多情 提交于 2019-12-20 10:43:39
问题 I'm trying to add a hyperlink to a mail merge field. So something like this: {HYPERLINK "{MERGEFIELD "Links" }"} So I create a field like this. { MERGEFIELD Links } And the above works (it displays different links for different recipients). However, when I go to Edit Field, and then attempt to add HYPERLINK to { MERGEFIELD Links}, Word will not allow me. Meaning that when I type HYPERLINK followed by a space, the "variable" field is gone. Instead of word displaying... LINK it displays...

How dangerous is it to let users specify RazorEngine templates?

我与影子孤独终老i 提交于 2019-12-19 06:52:40
问题 I have mail-merge like functionality, which takes a template, some business object, and produces html which is then made into PDF. I'm using RazorEngine to do the template+model to html bit. If I let the users specify the templates, what risks am I taking? Is it possible to mitigate any risks? For example, could the users execute arbitrary code? (delete files, alter database, etc.?) Is there some way I can detect this sort of thing? (I know that would be impossible generally, but the bits of

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 do I insert a mergefield into an If..else statement in VBA using Word MailMerge?

可紊 提交于 2019-12-18 09:26:22
问题 The below macro will input the field heading followed by the field value. The If statement should check the value of the field and if its greater than 30 the actual value is given, otherwise a zero. Instead of the value appearing if it's true, I just get the actual text I've typed, not it's value. Sub Macro1() Dim doc As Word.Document Dim dtField As Word.MailMergeDataField Dim sFieldName As String Dim sFieldActualName As String Dim j As Integer Set doc = ActiveDocument j = 1 For Each dtField

Skipping blank emails in Google Apps Script Mail Merge

丶灬走出姿态 提交于 2019-12-13 07:25:23
问题 I'm using this Simple Mail Merge Tutorial to help me create a mail merge to send students and their parents a summary of their completed community service hours. Their email addresses are in a Google Sheets doc. The script works until it hits a blank cell. Then it gives me an error that says "Invalid email: undefined" with a reference to the line in the script with the send email command. I've temporarily solved this within the spreadsheet itself by having it plug in a dummy email into any

MS Word 2010 mailmerge in Delphi 5

橙三吉。 提交于 2019-12-13 05:17:27
问题 could anyone help? I've inherited some software written in Delphi 5 which allows member data and fields from a database (.ADT file) to be used merged in to word. It works fine with all version of Word except 2010 where it won't load any documents and shows the error: "That Method is not available on that object" I have been told the solution is to replace the preset components OpWord and OpDataSet with Ole variants. I have done so with OpWord using: wrdApp := CreateOleObject('Word.Application

Running Mail Merge from Excel on an Embedded .docx (Word) file

别来无恙 提交于 2019-12-13 01:07:23
问题 Please help on figuring this out as I'm stuck at the last stage trying to properly define my variables in the following code. I want to execute the following in sequence: Click the button 'CommandButton1' The Form called 'CR_MMFormTest', which is an embedded document, will then open (mergefields already completed with no datasource pointed at, at the moment) VBA helps me create a replica of the Form, and use that for.... Calling the function DistrictMailMerge The problem, I encountered, lies

Microsoft Office Word 2016 mail merge custom invalid recipement for greeting line

一曲冷凌霜 提交于 2019-12-12 04:24:53
问题 I have a list of emails and some are for company names and others have first name last name. If I include the greetings line for "hello first_name last_name" it works but I want it to say "hello company_name" if there is no first name. Is there a way to do this? 回答1: To place this logic into your mail merge I suggest forgoing the Greeting Line and instead nesting Merge Field Codes inside a Word If, Then, Else statement. Field Codes are invisible markers and logic that Word replaces with text