Generating PPT and XLS in ColdFusion 9

Download Report

Transcript Generating PPT and XLS in ColdFusion 9

Generating PPT and XLS in
ColdFusion 9
Ajay Sathuluri
TeraTech
1
About Me









2
Senior Web/Database Engineer, Instructor
Certified ColdFusion Developer
Microsoft Certified Solution Developer
10+ years with ColdFusion
8+ years with Fusebox

Also work with SQL, Oracle, JavaScript, VB, HTML, AJAX
Server Tuning, Administration, Load Testing
Teach one-on-one and custom classes
On site and custom development
Fusebox and Process Methodology
What are we covering?
A.
Powerpoint generation and processing
 Also PPT to PDF
B. Excel generation and processing
C. Word and PDF
3
Cfspreadsheet
A.
B.




C.



D.
4
Manages Excel spreadsheet files
Read a sheet from a spreadsheet file and store it in:
ColdFusion spreadsheet object
query
CSV string
HTML string
Write a single sheet to:
new XLS file from a query
ColdFusion spreadsheet object
CSV string variable
Add a sheet to an existing XLS file
Spreadsheet functions
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
5
SpreadsheetAddColumn
SpreadsheetAddFreezePane
SpreadsheetAddImage
SpreadsheetAddInfo
SpreadsheetAddRow
SpreadsheetAddRows
SpreadsheetAddSplitPane
SpreadsheetCreateSheet
SpreadsheetDeleteColumn
SpreadsheetDeleteColumns
SpreadsheetDeleteRow
SpreadsheetDeleteRows
SpreadsheetFormatCell
SpreadsheetFormatColumn
SpreadsheetFormatColumns
SpreadsheetFormatRow
SpreadsheetFormatRows
SpreadsheetGetCellComment
SpreadsheetGetCellFormula
SpreadsheetGetCellValue
SpreadsheetInfo
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
SpreadsheetMergeCells
SpreadsheetNew
SpreadsheetRead
SpreadsheetReadBinary
SpreadsheetSetActiveSheet
SpreadsheetSetActiveSheetNumber
SpreadsheetSetCellComment
SpreadsheetSetCellFormula
SpreadsheetSetCellValue
SpreadsheetSetColumnWidth
SpreadsheetSetFooter
SpreadsheetSetHeader
SpreadsheetSetRowHeight
SpreadsheetShiftColumns
SpreadsheetShiftRows
SpreadsheetWrite
Spreadsheet Functions: Demo
A.
B.
Create with SpreadsheetNew()
Set values of cells:
 SpreadsheetSetValue
a)
b)

SpreadsheetSetFormula
a)
C.
6
Basic value
However, first time you touch this cell within Excel, it may
auto-reformat. If there is an = sign at front, it will switch it
to a formula
Specify from the beginning that this cell is a formula
Demo
PowerPoint
A.
CFPresentation introduced in CF8; only exported to
Acrobat Connect-style flash presentations
B. New:
 export to PPT
a)

C.
7
HTML file, generated HTML/images
read from PPT slides
Note: Saving presentation to “HTML” format really
means generating a Connect-style Flash
presentation
PowerPoint Demo: HTML to PPT
8
A.
B.
Generating HTML, just like to Browser
One slide comes from an HTML file
C.
Demo
PowerPoint demo: PPT to Connect
9
A.
Can take slides from a PPT file
B.
Demo
cfdocument
A.


B.




10
In addition to the existing functionality:
Convert Word documents and PowerPoint presentations to
PDF
All versions of MS Word and MS PowerPoint from 97 to
2003 are supported
Uses OpenOffice, installed on the server
Required for DOC -> PDF
Used, but optional, for reading PPT
To install OpenOffice
http://download.openoffice.org/index.html .
Unclear whether the QuickStarter needs to be running
cfdocument
A.
B.
“format” attribute is required
Either “src” or “srcfile” for the source

“src” attribute - URL or the relative path to the web root.
a)
b)

“srcfile” attribute - Absolute path of a file that is on the server.
a)
C.
11
The file must be in a browser-writable format such as, HTML
Not .doc file
Specify only the absolute path, eg:
"c:\documents\MyDocument.doc".
If you do not specify the filename attribute, it saves to a temp
folder and opens the converted PDF in a browser.
Convert .doc to .pdf: DEMO
A.
12
<cfdocument
format="pdf“
srcfile="C:\documents\MyDocument.doc"
filename="C:\documents\MyDocument.pdf"> </cfdocument>
Convert .ppt to .pdf: DEMO
A.
13
<cfdocument
format="pdf"
srcfile="C:\documents\MyPresentation.ppt"
filename="C:\documents\MyPresentation.pdf"> </cfdocument>
cfdocument: Gotcha
A.
B.
14
In the Adobe CFML reference help
“PERMISSIONSPASSWORD” attribute is misspelled
as “permissionpasswrd”, do not copy the this attribute
from Adobe CFML reference.
Adobe listed MS Word and MS PPT can be
converted to PDF, but cfdocument can also convert
.xls to .pdf
Convert .xls to .pdf: DEMO
A.
15
<cfdocument
format="pdf"
srcfile="C:\documents\sales.xls"
filename="C:\documents\sales.pdf"> </cfdocument>
Supported Office conversion formats
Format
From
CFML Tag
OpenOffice
installation
To
PPT
Connect Presentation
cfpresentation
optional
PPT
HTML
cfpresentation
optional
PPT
HTML
PDF
PPT
cfdocument
cfpresentation
optional
not required
Excel
HTML
cfspreadsheet
not required
Excel
Query
cfspreadsheet
not required
Excel
In-memory Variable
cfspreadsheet
not required
Query
Excel
cfspreadsheet
not required
In-memory variable
Excel
cfspreadsheet
not required
Word
PDF
cfdocument
required
From Livedocs,
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS9D9ADC
95-B37C-4aae-B5D1-84D72FF83BEB.html
16
Questions?
17