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

313 views
249 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
313
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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!

×