| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45
Back To Interview list
Michael Smith: I am talking with Samuel Neff about his talk at CFUN-04 "Integrating ColdFusion with Microsoft Office". Why would a programmer want to do that, Sam?
Sam Neff: There are many reasons a developer would want to integrate Microsoft Office output into their application. One of the first limitations developers run into with HTML is lack of precise control over the variety of client configurations; outputting to a Microsoft Office document allows you to regain control and produce reports that look the way you want. Office also gives the user a document that they have control over--they can print it as is or choose to make annotations and modifications. Additionally, Microsoft Office has a very large feature set that we can leverage in our applications, such as printing mailing labels.
MS: That sounds cool, but isn't it really hard to program this stuff because office documents are binary files?
SN: Certainly it would be difficult to write out a binary file directly in ColdFusion that creates an Office document, but in my presentation I'll review six different techniques that can be used to create Office documents that don't involve directly writing binary data or even directly creating Rich-Text Format data. I'll talk about (1) using Automation to control an instance of Microsoft Office running on the server, (2) using Office Web Components to generate binary Office documents though a COM interface that bypasses the Office GUI, (3) using a free COM object from Microsoft to read and write document properties, (4) using the Microsoft Jet engine to read and write data to Excel files using familiar database syntax, (5), creating new Office documents from scratch using only HTML, XML, and CSS, and (6) creating Office documents from scratch using a pure-XML grammar.
MS: Wow, that is smart! Which technique is your favorite and why?
SN: While I do have a favorite, I would like to first stress that there is no one-size-fits-all solution and knowing many techniques is the key to being able to create the best solution for your projects. When creating documents from scratch or from a template, I prefer the HTML/XML/CSS technique since it reuses existing knowledge and is easily adaptable to both on-screen and in-office displays.
MS: That sounds good for writing new office documents, but what about reading them?
SN: If you're reading in a document then you're usually talking about an Excel file. In my presentation I'll go over using the Microsoft Jet database engine to read in data from Excel and even show an example exactly on this topic. Many developers that migrated from CF5 to CFMX noticed the loss of the dynamic connection attributes on CFQUERY and I'll show attendees how to work around this CFMX limitation. In cases where more control is required, all Office applications can be manipulated on the server through a process called automation. Since automation is very common and widely used, I'll talk about it but actually discourage developers from using it in any server-based application due to problems with unattended execution.
MS: It sounds like your session covers all the bases. I am excited to see it!