views:

9

answers:

2

Env.: Reporting Services or XTraReport, SqlServer Express 2008 R2, VS2008, WinForms, C#

Hi All,

My WinForms app must send a customized letter to a bunch of people (whose contact info is in SqlServer). This is the typical job for Word Mail/Merge.

But I'd like to do it without Word installed on client computers. I'd rather use MS Reporting Services (or DevExpress XtraReport).

The problem is those tools allow me to put text boxes for name and address (that's fine) but they aren't real word processors. I need to embed custom fields in the flow of the text. This is easily done in Word but I can't find a way to do it in Reporting Services.

Note: I'm a newbie as far as reporting is concerned.

Please help,

TIA.

Serge.

A: 

In MS Reporting Services, you can set the value of a text field to a VB expression, rather than a fixed string. Use that expression to insert your database fields into the text.

For example you might have an expression like this one:

="Dear "+Fields!FirstName.Value+","

For a more sophisticated approach, you could use placeholders in your text and replace them with some regular expressions. In that case you'd probably want to embed the code in the report or an assembly and just call it as a function from your text field.

Adrian Grigore
Adrian, thanks for your help. Right now, I'll stick to xtra report though as explained in my answer.
Serge - appTranslator
A: 

I discovered that DevExpress XtraReport can do what I want: One can embed fields into the text of RichEdit controls:

Hello [firstName], your subscription elapsed on [lastDay!dd/MM/yyyy]

Also, the mailing issue is solved by having a report which only consists in a Detail band.

I would have preferred a MS Reporting Services solution but this one nicely fits my needs.

Serge - appTranslator