Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
How ColdFusion saved mefrom a week of grunt work Using SQL Server and Coldfusionto generate 600 Word Documents.
Buy One Class – Get One Class 50% off           until December 15
Why ColdFusion?• Quick learning curve• Similar style to HTML with opening and closing tags• Supported by Adobe and frequen...
Can you guess what this does?  <cfloop index="i" from="1" to="10">         <cfoutput> <p> #i# </p> </cfoutput>  </cfloop>
Can I get this outline as a Word Doc?                     Ummm…    No.
<cfoutput>      <h1>#database.h1#</h1>      <h2>#database.h2#</h2>      #database.classOutline#</cfoutput>
I need all of our outlines in Word                    … super.
Can ColdFusion come to my rescue?           Yup!
Step 1: Get the info from the database<cfquery name="allOutlines" datasource="datasource"               username="username...
Step 2: Output class info into a variable<cfoutput query="allOutlines">     <cfsavecontent variable="myDocument">     <htm...
Step 3: Write variable into Word Doc<body>          <cfoutput>            <h1>#allOutlines.Name#</h1>            <p>#allOu...
This is my lonely directory
my directory with lots of friends…
SUPER CODER!
Coldfusion with Keith Diehl
Coldfusion with Keith Diehl
Coldfusion with Keith Diehl
Upcoming SlideShare
Loading in …5
×

Coldfusion with Keith Diehl

340 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Coldfusion with Keith Diehl

  1. 1. How ColdFusion saved mefrom a week of grunt work Using SQL Server and Coldfusionto generate 600 Word Documents.
  2. 2. Buy One Class – Get One Class 50% off until December 15
  3. 3. Why ColdFusion?• Quick learning curve• Similar style to HTML with opening and closing tags• Supported by Adobe and frequently updated with new features• ColdFusion isn’t free but also not that expensive• Hosted ColdFusion accounts are about $30 a month• Free Developer Edition
  4. 4. Can you guess what this does? <cfloop index="i" from="1" to="10"> <cfoutput> <p> #i# </p> </cfoutput> </cfloop>
  5. 5. Can I get this outline as a Word Doc? Ummm… No.
  6. 6. <cfoutput> <h1>#database.h1#</h1> <h2>#database.h2#</h2> #database.classOutline#</cfoutput>
  7. 7. I need all of our outlines in Word … super.
  8. 8. Can ColdFusion come to my rescue? Yup!
  9. 9. Step 1: Get the info from the database<cfquery name="allOutlines" datasource="datasource" username="username" password="password"> SELECT ID, Name, Days, H1, ClassOutline, FileName FROM classroomTable ORDER BY Name</cfquery>
  10. 10. Step 2: Output class info into a variable<cfoutput query="allOutlines"> <cfsavecontent variable="myDocument"> <html xmlns:w="urn:schemas-microsoft-com:office:word"> <!--- Head tag instructs Word to start up a certain way, specifically in print view. ---> <head> <xml> <w:WordDocument> <w:View>Print</w:View> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:DoNotOptimizeForBrowser/> </w:WordDocument> </xml> </head>
  11. 11. Step 3: Write variable into Word Doc<body> <cfoutput> <h1>#allOutlines.Name#</h1> <p>#allOutlines.Days# <cfif allOutlines.Days GT "1">days<cfelse>day</cfif></p> #allOutlines.classOutline# </cfoutput></body></html></cfsavecontent><cfscript> FileWrite("Server:word-outlines#allOutlines.ID#-#allOutlines.FileName#.doc", "#myDocument#");</cfscript></cfoutput>
  12. 12. This is my lonely directory
  13. 13. my directory with lots of friends…
  14. 14. SUPER CODER!

×