well i have figured out exactly what the problem is. for some reason excel doesnt like the fact that i have a defined a query in it. i am wondering if there is a namespace or something that i can define at the beginning of my code that will allow excel to deal with the query. this is my code that should work.
CODE
<cfsetting showdebugoutput="false">
<!--- Gets the report key from the url that was passed from the previous page (ExportToExcel.cfm) --->
<cfparam name="url.reportkey" default="None">
<!--- Get the name of the report to be used in the file name --->
<cfquery name="getReportName" datasource="#session.sysdb#">
SELECT ReportName, ReportKey
FROM DictionaryReport
WHERE ReportKey = '#url.reportkey#'
</cfquery>
<cfoutput query="getReportName">
<cfset ReportName=#ReportName#>
</cfoutput>
<!--- Tells coldfusion what type of file will be created (excel spreadsheet) and names the file --->
<cfheader name="content-disposition" value="inline;filename=#ReportName#ReportData.xls">
<cfcontent type="application/msexcel">
<!--- The queries to get all of the data for the spreadsheets --->
<cfquery name="getReport" datasource="#session.sysdb#">
SELECT *
FROM DictionaryReport
WHERE ReportKey = '#url.reportkey#'
</cfquery>
<cfquery name="getTableName" datasource="#session.sysdb#">
SELECT *
FROM DictionaryTable
WHERE DictionaryTable.ReportKey = '#url.reportkey#'
ORDER BY DisplayOrder
</cfquery>
<cfquery name="getTable" datasource="#session.sysdb#">
SELECT DictionaryTable.TableShortName, DictionaryTable.TableKey, DictionaryTable.TableDescription, DictionaryTable.DisplayOrder, DictionaryTable.ReportKey, DictionaryField.ReportKey, DictionaryField.TableKey, DictionaryField.FieldName, DictionaryField.FieldDataType, DictionaryField.IsPickList, DictionaryField.FieldLength, DictionaryField.DisplayOrder, DictionaryField.LookupTable, DictionaryField.LookupType, DictionaryField.FieldRequired, DictionaryField.FieldDescription
FROM DictionaryTable
INNER JOIN DictionaryField ON DictionaryTable.TableKey = DictionaryField.TableKey
WHERE DictionaryTable.ReportKey = '#url.reportkey#'
AND DictionaryField.ReportKey = '#url.reportkey#'
ORDER BY DictionaryTable.DisplayOrder, DictionaryField.DisplayOrder
</cfquery>
<!--- Creates the excel file --->
<?xml version="1.0"?>
<ss:Workbook
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel">
<!--- Creates the various styles/formats to be used on data --->
<ss:Styles>
<ss:Style ss:ID="Header">
<ss:Font ss:FontName="Calibri" ss:Bold="1" ss:Size="15"/>
</ss:Style>
<ss:Style ss:ID="Description">
<ss:Alignment ss:WrapText="1" ss:Vertical="Top"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Top"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Left"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Right"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="TableDescription">
<ss:Alignment ss:WrapText="1" ss:Vertical="Top"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Top"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Left"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Bottom"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Right"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="Sides">
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Left"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Right"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="Ordinality">
<ss:Alignment ss:Horizontal="Right"/>
</ss:Style>
<ss:Style ss:ID="Subheader">
<ss:Font ss:FontName="Calibri" ss:Bold="1" ss:Size="13"/>
<ss:Alignment ss:Horizontal="Right"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="2" ss:Position="Bottom"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="TopLeft">
<ss:Alignment ss:Horizontal="Right"/>
<ss:Interior ss:Color="#CCCCCC" ss:Pattern="Solid"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Left"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Top"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="Top">
<ss:Alignment ss:Horizontal="Right"/>
<ss:Interior ss:Color="#CCCCCC" ss:Pattern="Solid"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Top"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="TopRight">
<ss:Alignment ss:Horizontal="Right"/>
<ss:Interior ss:Color="#CCCCCC" ss:Pattern="Solid"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Right"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Top"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="DescriptionRight">
<ss:Alignment ss:WrapText="1" ss:Vertical="Top"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Right"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="Right">
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Right"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="Left">
<ss:Alignment ss:Horizontal="Right"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Left"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="BottomLeft">
<ss:Alignment ss:Horizontal="Right"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Left"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Bottom"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="BottomRight">
<ss:Alignment ss:WrapText="1" ss:Vertical="Top"/>
<ss:Borders>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Bottom"/>
<ss:Border ss:LineStyle="Continuous" ss:Color="Black" ss:Weight="1" ss:Position="Right"/>
</ss:Borders>
</ss:Style>
</ss:Styles>
<!--- Creates the Worksheet and sets the page layout to landscape --->
<ss:Worksheet ss:Name="Report Data">
<x:WorksheetOptions>
<x:PageSetup>
<x:Layout x:Orientation="Landscape"/>
</x:PageSetup>
</x:WorksheetOptions>
<!--- Sets up the table which will contain all of the data. Loops the queries to get
all of the data and put it in the specific cells and rows. Also formats the
cells, rows, and columns. --->
<ss:Table>
<ss:Column ss:Index="1" ss:Width="200"/>
<ss:Column ss:Index="2" ss:Width="150"/>
<ss:Column ss:Index="3" ss:Width="87"/>
<ss:Column ss:Index="4" ss:Width="47"/>
<ss:Column ss:Index="5" ss:Width="98"/>
<cfoutput query="getReport">
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Header"><ss:Data ss:Type="String">Report Name: #Module# #ReportType#</ss:Data></ss:Cell>
</ss:Row>
</cfoutput>
<cfoutput query="getReport">
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Ordinality"><ss:Data ss:Type="String">Description:</ss:Data></ss:Cell>
<cfif #ReportDescription# eq "">
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="TableDescription"><ss:Data ss:Type="String">No Description Entered</ss:Data></ss:Cell>
</ss:Row>
<ss:Row></ss:Row>
<cfelse>
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:MergeDown="5" ss:StyleID="TableDescription"><ss:Data ss:Type="String">#ReportDescription#</ss:Data></ss:Cell>
</ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
</cfif>
</cfoutput>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Subheader"><ss:Data ss:Type="String">Tables</ss:Data></ss:Cell>
<ss:Cell ss:Index="2" ss:StyleID="Subheader"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
<ss:Cell ss:Index="3" ss:StyleID="Subheader"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
<ss:Cell ss:Index="4" ss:StyleID="Subheader"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
<ss:Cell ss:Index="5" ss:StyleID="Subheader"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<cfoutput query="getTableName">
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Ordinality"><ss:Data ss:Type="String">#TableShortName#</ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Ordinality"><ss:Data ss:Type="String">Description:</ss:Data></ss:Cell>
<cfif #TableDescription# eq "">
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="TableDescription"><ss:Data ss:Type="String">No Description Entered</ss:Data></ss:Cell>
</ss:Row>
<ss:Row></ss:Row>
<cfelse>
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:MergeDown="7" ss:StyleID="TableDescription"><ss:Data ss:Type="String">#TableDescription#</ss:Data></ss:Cell>
</ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
</cfif>
</cfoutput>
<ss:Row></ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Subheader"><ss:Data ss:Type="String">Fields</ss:Data></ss:Cell>
<ss:Cell ss:Index="2" ss:StyleID="Subheader"><ss:Data ss:Type="String">Table Name</ss:Data></ss:Cell>
<ss:Cell ss:Index="3" ss:StyleID="Subheader"><ss:Data ss:Type="String">Data Type</ss:Data></ss:Cell>
<ss:Cell ss:Index="4" ss:StyleID="Subheader"><ss:Data ss:Type="String">Length</ss:Data></ss:Cell>
<ss:Cell ss:Index="5" ss:StyleID="Subheader"><ss:Data ss:Type="String">Field Required?</ss:Data></ss:Cell>
</ss:Row>
<cfoutput query="getTable">
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="TopLeft"><ss:Data ss:Type="String">#FieldName#</ss:Data></ss:Cell>
<ss:Cell ss:Index="2" ss:StyleID="Top"><ss:Data ss:Type="String">#TableShortName#</ss:Data></ss:Cell>
<ss:Cell ss:Index="3" ss:StyleID="Top"><ss:Data ss:Type="String">#FieldDataType#</ss:Data></ss:Cell>
<ss:Cell ss:Index="4" ss:StyleID="Top"><ss:Data ss:Type="Number">#FieldLength#</ss:Data></ss:Cell>
<cfif #FieldRequired# eq "0">
<ss:Cell ss:Index="5" ss:StyleID="TopRight"><ss:Data ss:Type="String">No</ss:Data></ss:Cell>
<cfelse>
<ss:Cell ss:Index="5" ss:StyleID="TopRight"><ss:Data ss:Type="String">Yes</ss:Data></ss:Cell>
</cfif>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String">Description:</ss:Data></ss:Cell>
<cfif #FieldDescription# eq "">
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="DescriptionRight"><ss:Data ss:Type="String">No Description Entered</ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="Right"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<cfelse>
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:MergeDown="10" ss:StyleID="DescriptionRight"><ss:Data ss:Type="String">#FieldDescription#</ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell ss:Index="1" ss:StyleID="Left"><ss:Data ss:Type="String"></ss:Data></ss:Cell>
</ss:Row>
</cfif>
<ss:Row>
<cfif #IsPickList# eq "0" OR #IsPickList# eq "">
<ss:Cell ss:Index="1" ss:StyleID="BottomLeft"><ss:Data ss:Type="String">Lookup Values:</ss:Data></ss:Cell>
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="BottomRight"><ss:Data ss:Type="String">This field is not a picklist</ss:Data></ss:Cell>
<cfif #LookupTable# eq "" OR #LookupType# eq "">
<ss:Cell ss:Index="1" ss:StyleID="BottomLeft"><ss:Data ss:Type="String">Lookup Values:</ss:Data></ss:Cell>
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="BottomRight"><ss:Data ss:Type="String">The lookup table and type are not defined</ss:Data></ss:Cell>
<cfelse>
<cfquery name="Lookup" datasource="#session.sysdb#">
SELECT LookupType, DisplayOrder, LookupValue
FROM #getTable.LookupTable#
WHERE LookupType = '#getTable.LookupType#'
ORDER BY DisplayOrder, LookupValue
</cfquery>
<ss:Cell ss:Index="1" ss:StyleID="BottomLeft"><ss:Data ss:Type="String">Lookup Values:</ss:Data></ss:Cell>
<ss:Cell ss:Index="2" ss:MergeAcross="3" ss:MergeDown="5" ss:StyleID="BottomRight"><ss:Data ss:Type="String"><cfset commaStopper = ""><cfloop query="Lookup">#commaStopper# #LookupValue#<cfset commaStopper = ","></cfloop></ss:Data></ss:Cell>
</cfif>
</ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
<ss:Row></ss:Row>
</cfoutput>
</ss:Table>
</ss:Worksheet>
</ss:Workbook>
the lookup query is within the cfoutput tags for the get table query which allows it to properly reference the values. also i have the if statement which prevents the query from being read with an empty field. the reason i know this code should work is because i tested it like this.
CODE
<cfsetting showdebugoutput="false">
<!--- Gets the report key from the url that was passed from the previous page (ExportToExcel.cfm) --->
<cfparam name="url.reportkey" default="None">
<!--- Get the name of the report to be used in the file name --->
<cfquery name="getReportName" datasource="#session.sysdb#">
SELECT ReportName, ReportKey
FROM DictionaryReport
WHERE ReportKey = '#url.reportkey#'
</cfquery>
<cfoutput query="getReportName">
<cfset ReportName=#ReportName#>
</cfoutput>
<!--- The queries to get all of the data for the spreadsheets --->
<cfquery name="getReport" datasource="#session.sysdb#">
SELECT *
FROM DictionaryReport
WHERE ReportKey = '#url.reportkey#'
</cfquery>
<cfquery name="getTableName" datasource="#session.sysdb#">
SELECT *
FROM DictionaryTable
WHERE DictionaryTable.ReportKey = '#url.reportkey#'
ORDER BY DisplayOrder
</cfquery>
<cfquery name="getTable" datasource="#session.sysdb#">
SELECT DictionaryTable.TableShortName, DictionaryTable.TableKey, DictionaryTable.TableDescription, DictionaryTable.DisplayOrder, DictionaryTable.ReportKey, DictionaryField.ReportKey, DictionaryField.TableKey, DictionaryField.FieldName, DictionaryField.FieldDataType, DictionaryField.IsPickList, DictionaryField.FieldLength, DictionaryField.DisplayOrder, DictionaryField.LookupTable, DictionaryField.LookupType, DictionaryField.FieldRequired, DictionaryField.FieldDescription
FROM DictionaryTable
INNER JOIN DictionaryField ON DictionaryTable.TableKey = DictionaryField.TableKey
WHERE DictionaryTable.ReportKey = '#url.reportkey#'
AND DictionaryField.ReportKey = '#url.reportkey#'
ORDER BY DictionaryTable.DisplayOrder, DictionaryField.DisplayOrder
</cfquery>
<cfoutput query="getTable">
<cfif #IsPickList# eq "0" OR #IsPickList# eq "">
its not a picklist
<cfelseif #LookupType# eq "" OR #LookupTable# eq "">
none
<cfelse>
<cfquery name="Lookup" datasource="#session.sysdb#">
SELECT *
FROM #getTable.LookupTable#
WHERE LookupType = '#getTable.LookupType#'
ORDER BY DisplayOrder, LookupValue
</cfquery>
<cfset commaStopper = "">
<cfloop query="Lookup">
#commaStopper# #LookupValue#
<cfset commaStopper = ",">
</cfloop>
</cfif>
<br>
</cfoutput>
this code properly loops both queries and doesnt have a problem. this second code just simply displays the output on a webpage. so i have determined that excel is having the problem running the code. if there are any experts on exporting to excel please help! thanks!