Hi Piotr I have been doing just this using XML files exported from DP. One of the major advantages is that you do not even need Word to generate the final document only to create the seed document. The other is that it is incredibly simple after the initial learning curve, quick, reliable and infitiely flexible.
I am not sure if you are familiar with XML, but it is a text file which carriers both the data and tags top identify the data. Although it looks like HTML it is unlike it that it does not carry any presentation of the data, only the data and the description of the data. Being text it is ideal for use with DataPerfect and DP2.6x includes some basic XML features to allow you to handle XML entities. (eg because XML tags start with a "<" that character is generally illegal to be directly used in XML instead it needs to be represented as <) DataPerfect has a new format indicator for use the Alphanumeric (Memo) fields which will convert the main characters that are illegal in XML into their correct entity format XML is also standards based which means many standards based technologies and tools have been developed to work with it. Two such technologies are XPath and XSLT. XPath is a mechanism for specifying pasts of an XML document. XSLT is a means of transforming XML into another format. In both Word2003 and Word 2007 (albeit slighyly differently) you can save a document in XML format. In fact in Word2007 I think the default is now to save it doucuments DOCX (an XML file) format which is just being or has been included as an ISO standard. This means Word has entered a domain where DP can really shine. In fact as a data source for Word, DataPerfect is far better and easier to use than having your data in either SQL Server or Microsoft Access. The basic process entails taking XML data, and applying a transformation to create the final Word document. The transformation is done by taking a style file (an XSLT file) and using an XSLT processor to combine the two. XSLT processors are everywhere, Internet Explorer, Firefox, and every other recent web browser can be used in style a file. Generally when you use these processors the output you require is HTML, but thats the beauty of XML and XSLT the output can be also sorts of things. The processors itself is generic, so these browsers could just as easily coming XML data and an XSLT style sheet to make a natve Word document. You can also use stand alone XSLT processors. Ok, now here is the catch. Microsoft are very quiet on the fact that you can create native Word documents without using Word. In fact they do not make it particularly obvious how to do it. They support it in their document creation, so that you can use XML documents to manual create and edit a new document but it does not create the XSLT file for you, although it tells you you can easily do this. One way of creating an XSLT file is to create a document save it as XML and then edit the resultant file with your favourite text editor or XML editor, however Microsoft knows that only a handful of people will learn how to expertly manage XXL, XPath and XSLT as well as understand WordML (the XML vocabulary that Word uses). However, if you know what you are looking for Microsoft does provide a couple of free tools which you can download to automate the process. The basic tool is the Word XSLT Inference tool. wml2xslt.exe which is a free Microsoft commandline tool http://msdn.microsoft.com/en-us/library/aa212886(office.11).aspx. The documentation that comes with the download is very scant. It talks about creating a seed document. The seed document is a Word document, based on an XML Schema (thats the definition of whats elements, or tags are in a document), and then saving the document as n XML file. Microsoft described the process of creating seed document at http://msdn.microsoft.com/en-us/library/aa212887(office.11).aspx Ok so why would you go to so much trouble just to create a mail merge?. I am glad you asked that question. Mail Merge is a very basic process, whether it is using Word or any of the various flavours of todays or past WordPerfect. The data need to be essentially a flat file. Most opf the work I have done in the past has been document automation, and I had a major document automation system which took DP data from many tables, and flattened into a high structured Secondary file form. They were complex document and each record in the Secondary file could contain a different number of fields (unlike normal mail merge which is fixed), each record would contain betwen 100 and about 3000 fields of data. This was merged using a series of nested WordPerfect Primary documents to create legal documents used for the creation of corporate entities. Inside the WordPerfect primary file was various Merge programming commands (these are like Macro commands but execute which the merge is running) which took the highly structured flattened data in the Secondary file and recreated the multitable structure that could be used to pull the documents together. Eventually you wouild have one 200 to 300 page document which included everything in legal document for create the entity, as well as invoices, letters etc. Tyhe merge would take about 10 seconds, and it could be printed as one total and complete print job ready for final packing an despatch. It was incredibly tedious and quite difficult to do. Every year or two I would have a go at using Microsoft Word however there was nothing in Word that would allow me to come close to the way it was done in WordPerfect, and the only way to do it in Word was to use lots of external programming, asnd creating loads of smaller documents and printing them separately. Word sucks at document automation. The company using this system went from being a very minor, cottage industry sized,player in 1992 to the market leader by 2004, and acquired for a huge sum by a public company in 2005/ Anyway back to XML. XML and XSLT would have made this job a piece of cake. You can include relational and heirarchical data in the XML and create incredibly complicated Word documents. You can even create the conept of a Master document which brings in subsidiary external documents intelligently. Just take the following XML snippet for an invoice <XML verions="1.0") <invoice> <customer> <name>Acme Corporation<./name> <address>99 Long Street</address> <town>Ajaxville</town> </customer> <ordernumber>13243546</ordernumber> <date>20 May 2008</date> <lineitem no="1"> <item>nails</item> <qty>400<qty> <price>$0.03</price> </lineitem> <lineitem id="2"> <item>hammer</item> <qty>4<qty> <price>$27.93</price> </lineitem> <lineitem id=...... </lineitem> </invoice> Word Mail merge in Word could not handle the repeated lineitems elements. With XML and Word 2003 an invoice like this the seed document would take only minutes to create (you just drag and drop the fields to where you want them in the document. To create a new document you would just open the XML file in Word, and then select which stylesheet you wanted to apply against it. You would would not need Word to create new documents. Creating an XML data source in DP for this is also a no brainer. You can create new documents from the desktop, but you can also use this to have server side creation of documents, eg use DP on the web and deliver completed Word documents, compatible with Word 2003 or later. Word XML documents can include any feature used in Word, including tables, graphics, even other embedded objects such as Excel tables. So it could be a simple report, or a long structured document rich in formatting. DP actually works better than any of the other Microsoft XML export files (eg Access) as the Microsoft XML files contain a lot of junk that gets in the way of their wml2xslt.exe XSLT Inference tool, and so you cannot work directly with these files but first have to transform them into something simpler for Word to work with. Also there is an inaccuracy in the linked Microsoft document above "Creating a Seed Document using Word 2003" so that complex XML documents do not work properly. Call me cynical, but I think for many people who have stumbled upon using this technique find the problem might have come to the conclusion that it is not particularly useful, and abandoned it, because Microsoft heavily push other technologies costing lots of money, where this very open technology does it so incredibly well. If you or anyone else needs more assistance in using this technique please ask. Regards Brian ----- Original Message ----- From: piotrzyk Gazeta.pl To: Dataperfect Users Discussion Group Sent: Monday, May 19, 2008 9:03 PM Subject: [Dataperf] Merging DP reports into MS Word? Hello All, Generating reports and merging them into WordPerfect primary/secondary files works great. But some users are MS Word addict. Is it possible to merge DataPerfect reports into MS Word files? How can this be done directly / any bypass? I will be gratefull for any help. Have a good day, Piotr Barancewicz ------------------------------------------------------------------------------ _______________________________________________ Dataperf mailing list [email protected] http://lists.dataperfect.nl/mailman/listinfo/dataperf
_______________________________________________ Dataperf mailing list [email protected] http://lists.dataperfect.nl/mailman/listinfo/dataperf
