views:

148

answers:

8

In our LOB application there is a very important use case of printing letters, which are then printed and posted out from a mail house (thousands per day). The current situation is that the letter templates are created in Word 97 and fields are mail merged from values in database using a VB.Net application that basically uses word automation. But depending on Word 97 is not a good idea today. We only have a couple of PCs that have Word 97 installed as rest of the company has moved to Office 2007.

What software or technology (compatible with .Net) is available today that best suits this scenario. Is it better to do the same thing but move to Word 2007 or PDF or something else. Price may not be a factor. The important thing is that the letter templates must be designed by business users and data to fill placeholders come from DB.

A bonus would be to import the hundreds of existing Word 97 letter templates without rewriting them from scratch.

A: 

Well, for all kinds of reporting I used Crystal Reports, which allows you to easily retrieve information from database and fill in the form. You may use PDF or HTML format for that.

Sorantis
This is not exactly reporting. I am talking about non-technical business staff to create letter templates themselves without involving IT dept.
Pratik
A: 

My company has just recently dealt with this issue and we were using even more recent word 2003.

Firstly the use of Office products in a server style environment is not supported by microsoft and my experience will cause you alot of pain. Does the Vb.net application run on a client machine where a user can interact with the program or on a central server (you mentioned dedicated machines)

But this does not mean you cannot use office to create the templates. The office file (.docx) is a zip/compresseed xml file, which can be processed by text manipulation.

assuming the process is server based or not monitored, I would recommend a) upgrade all your templates to office files (.docx). b) use the office 2007 to maintain the templates c) either write or find a program that can take the (.docx) files, unzip them, and replace the merge fields. NOte this answer depends on the complexity of your templates. There are many programs that can deal with text replacement etc. d) run a program that can convert docx to pdf. Assuming the document does not require subsequent modification. finding a docx to pdf is possible.

are your templates simple? or do you have nested data, conditional formatting in the document and other such complexities?

Rimmeraj
A: 

We built something very similar at my company a few months ago. We used a library called DocIO by Syncfusion. The users create normal documents using MS Word (2003 or 2007) with standard Mail-Merge fields in them. These documents are then uploaded and stored in the application's database. We then use the DocIO library to do a mail-merge, passing in a DataTable of values to merge on:

byte[] templateDocument = . . .
DataTable data = . . .
Stream templateDocStream = new MemoryStream(templateDocument);
mailmergeDoc = new DocIO.WordDocument(templateDocStream);
mailmergeDoc.MailMerge.Execute(data);

We can then send the document down to the browser like this

Response.AddHeader("Content-Disposition", "attachment; filename=merged.doc");
doc.Save(Response.OutputStream, Syncfusion.DocIO.FormatType.Doc);
Response.End();
d4nt
A: 

My organisation is also looking to tackle a problem similar to this and I can share with you some of the things I've found. We're not doing it yet, still in the design stage so take the following with that in mind.

Your situation also depends on the required format at the mailing house - at the moment they must be accepting Word 97 documents, could they also accept XML, DOCX, PDF or something else?

There's a commercial product called Intelledox that lets you use Word 2003 (possibly as early as Word 2000?) as a template designer and then assemble documents from data sources which can be databases, web services etc. Looks like a pretty interesting product, depends on your budget though. This would probably rate highly on your criteria for end user template design.

You could look at the Open XML SDK which allows you to generate DOCX (Word 2007) files programmatically. Your business users would generate a template in Word and supply it to a developer who would then likely create an XSLT. This XSLT is then used at run time to programmatically replace the contents of the base Word document template. This doesn't require Word on the server, just the .NET DLLs that are part of the SDK. Downside to this is it requires a bit of developer processing each time a new template is generated.

I've also considered the reporting approach too - we use SQL Server Reporting Services and that could be used to generate the merged document. It supports Word, Excel, PDF and other export formats. The downside to this is that it also usually requires a developer to design the report. You could deploy the SQL Server Reporting Services Report Builder which is intended for power users to generate their own reports. If you consider this approach make sure it's SQL Server 2008 (Report Builder 2.0), apparently Report Builder v1.0 is pretty poor.

If the mailing house accepts XML you could supply the mailing house with an XSLT file and just send the data, rather than the assembled document. Not sure if the print house you use accepts that, or if you need to keep a copy of the completed document internally for auditing purposes.

Lastly it might be worth a look at the XPS format. Not sure how the templates for this would be design, it might be programming-heavy too.

Hope this helps with your thinking anyway!

Harv
A: 

Microsoft ReportViewer.

Aen Sidhe
A: 

So - you need report engine (report generator, reporting tool, etc.).

  1. Do you need advanced report/template visual designer for non technical end users? They can add, edit, create report templates. If no - you can select MS Reporting Services or Crystal.
  2. Do you need PDF / HTML and some native reporting format only? If yes - you also can select some of MS Reporting Services or Crystal.

But if you need visual report designer with set of wizards, more than 15 different export filteres (from PDF, XLS and HTML to DOCX, Open Documents, XPS and picturesXL) I can recommend you see the FastReport.Net

As the developer you can set the objects in reports, wich user can change in report and wich can not.

Merl
+1  A: 

Doesn't the office 2007 SDK deal with this sort of situation out of the box?

Alternatively you could look at sidestepping office and using wpf directly, with a commercial Rich text editor.

Doobi
A: 

Depending on the complexity of your letters layout, WPF might be a good option.

It's part of the .NET framework so you don't have to rely on any third party library's or apps which may not be updated the future. Which hopefully avoid a repeat of the issues you have with Office 97.

I know you've said price isn't an issue, but it is also free.

Twelve47