Export to Excel for Dreamweaver
This Server Behavior will generate a Comma-delimited (.csv) file out of a Recordset without writing it to the hosting server. Your web site user will be prompted to save the file to the hard drive to be open with Microsoft Excel (with an option to open the file directly in the browser (Internet Explorer only)).
In addition you can include Recordset column names in the first row of the exported file.
"Comma-delimited" format uses comma (or semi-column -depending on the locale) as a cell delimiter and line break as a row delimiter. If a field already contains a comma or a line break an undesirable shift of data may occur. To get around this problem this Server Behavior will replace all commas and line breaks in exported file (not in the database!!!) with a character of your choice and a space character respectively. In addition you can specify your own cell delimiter character (new in version 2.2.0).
Please Note: This server behavior will export the Recordset data only, not the entire page. If you need to export the page as is to either Microsoft Word or Excel (while controlling what gets and what doesn't get to be displayed in the exported document) you can download the Save to Word or Excel Server Behavior which does just that.
Dreamweaver version Compatibility
"Export to Excel" Example
This Server Behavior can be applied to more than one Recordset per page and the example below demonstrates just that. A table with company employees contains data for employees working in two Departments. The value of the dropdown menu is used by the Departments_rs recordset to extract the data for the selected Department only. When the form is submitted (by either selecting an item from the dropdown or clicking "Export") the Behavior is using the value of a hidden field in this form to determine that this time it will use this recordset for the export.
The page also contains Employees_Names_rs Recordset which grabs only First Name and Last Name parameters for ALL the employees regardless of the Department. Another form titled "Export Employees list (Names only)" has been added to the page. It contains its own hidden field and submit button. If this form is submitted the Behavior will catch the hidden field value and export the Employees_Names_rs Recordset.
|EMPLOYEE_ID||First Name||Last Name||Hourly Rate||Address||Department|
|1||Allan||Doe||$70/hr||#10 44 St, WorkCity CA||44|
|4||Frank||Doe||$40/hr||#22 5th Ave, WorkCity CA||22|
|2||Jane||Doe||$30/hr||#12 5th Ave. WorkCity CA||44|
|6||John||Doe||$55/hr||#22 5th Ave, WorkCity CA||22|
|7||Kevin||Doe||$40/hr||#2 44th St, WorkCity CA||22|
|3||Robert||Doe||$55/hr||#2 34th St, WorkCity CA||44|
|5||Tanya||Doe||$40/hr||#21 7th Ave, WorkCity CA||22|