170 likes | 360 Views
Serving Word. Using HTML, XML, and CSS to Dynamically Generate Word Documents Samuel R. Neff B-Line Express. Agenda. Automation Document Properties HTML, XML, CSS Formatting Labels Columns Headers, Footers Images Alternatives. Automation. Control one application from another
E N D
Serving Word Using HTML, XML, and CSS to Dynamically Generate Word Documents Samuel R. Neff B-Line Express Samuel R. Neff
Agenda • Automation • Document Properties • HTML, XML, CSS • Formatting • Labels • Columns • Headers, Footers • Images • Alternatives Samuel R. Neff
Automation • Control one application from another • Use COM object “Word.Application” • Complete flexibility and power • Limitations • Unattended execution • Slow • CF COM Support (all versions) Samuel R. Neff
Document Properties • Small quantities of data • Very fast and easy to use • Safe for servers • Limitations • CF COM Support (all versions) • Java version incomplete (Apache POI) Samuel R. Neff
HTML, XML, CSS • Familiar • Fast • Flexible Samuel R. Neff
Hello Word Example:helloword.cfm Samuel R. Neff
Sections Pages Margins @page Section1 { size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; } div.Section1 { page:Section1; } Basic Formatting Example:letter01.cfm Samuel R. Neff
Paragraph Formatting Example: letter02.cfm Samuel R. Neff
Labels Example: labels01.cfm Samuel R. Neff
Advanced Labels • Different sizes and layouts • Page Margin • Row Height • Paragraph Margins • Number of Columns • Spacers • Reuse code • Despite varying content • ColdFusion Components • Not all labels can be generated Examples: labels02.cfm, labels03.cfm, WordLabelGenerator*.cfc Samuel R. Neff
Columns Example: columns01.cfm Samuel R. Neff
Multi-File Documents Examples: MultipartMIME_Example.htm, MultipartMIME.cfc Samuel R. Neff
Headers & Footers Example: columns02.cfm Samuel R. Neff
Images • Use standard <img> tag • Include image in the file list • Include image in Multipart MIME message • Component automatically encodes as Base64 Example: columns03.cfm Samuel R. Neff
Resources • Save as Web Page • Microsoft® Office HTML and XML Reference • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffxml/html/ofxml2k.asp • RFCs 2045 and 2046 • http://www.ietf.org/rfc/rfc2045.txt • http://www.ietf.org/rfc/rfc2046.txt Samuel R. Neff
Conclusions • HTML/XML/CSS Faster and more stable than COM • Can be used for most dynamic Word applications • Builds upon existing developers' skill set Samuel R. Neff
Questions sam@blinex.com Samuel R. Neff