I'm exporting data to an Excel Spreadsheet but when the Excel
spreadsheet is generated, if the user has used a carriage return
during data entry, it creates a a new row in Excel.
I've tried using a replace in the export field
#replace(Comments,Chr(13),"", "all")#
and if I use:
#replace(Comments,Chr(13),"xx", "all")#
I can actually see the xx, but the extra row is still being created before the rest of the entry starts.
Any ideas on getting rid of the line breaks during export?
Full Code is below (edited for clarity).
<CFSET tab=chr(9)>
<CFSET carriage=chr(13)>
<cfif action IS "export">
<CFHEADER name="Content-Disposition" value="inline; filename=MNC_Data.xls">
<cfcontent type="application/vnd.ms-excel">
<cfquery name="get_Data" datasource="#appDSN#">
SELECT ml.DateSubmitted, ml.FirstName,
ml.LastName, ml.Address1,
ml.Address2, ml.City, ml.State, ml.comments,
FROM #diff#mailing ml
</cfquery>
<cfoutput>Location#tab#Date Submitted#
FirstName#tab#
LastName#tab#
Address1#tab#
Address2#tab#
City#tab#
State#tab#
Postal#tab#
Comments#carriage#</cfoutput>
<cfoutput query="get_Data">
#LSDateFormat(DateSubmitted,'MM/DD/YYYY')##tab##TimeFormat(timestamp,' hh:mm:ss tt') ##tab#
#FirstName##tab#
#LastName##tab#
#Address1##tab#
#Address2##tab#
#City##tab#
#State##tab#
#Postal##tab#
#replace(get_Data.Comments,Chr(13),"", "all")#
#carriage#</cfoutput>
I've tried using a replace in the export field
#replace(Comments,Chr(13),"", "all")#
and if I use:
#replace(Comments,Chr(13),"xx", "all")#
I can actually see the xx, but the extra row is still being created before the rest of the entry starts.
Any ideas on getting rid of the line breaks during export?
Full Code is below (edited for clarity).
<CFSET tab=chr(9)>
<CFSET carriage=chr(13)>
<cfif action IS "export">
<CFHEADER name="Content-Disposition" value="inline; filename=MNC_Data.xls">
<cfcontent type="application/vnd.ms-excel">
<cfquery name="get_Data" datasource="#appDSN#">
SELECT ml.DateSubmitted, ml.FirstName,
ml.LastName, ml.Address1,
ml.Address2, ml.City, ml.State, ml.comments,
FROM #diff#mailing ml
</cfquery>
<cfoutput>Location#tab#Date Submitted#
FirstName#tab#
LastName#tab#
Address1#tab#
Address2#tab#
City#tab#
State#tab#
Postal#tab#
Comments#carriage#</cfoutput>
<cfoutput query="get_Data">
#LSDateFormat(DateSubmitted,'MM/DD/YYYY')##tab##TimeFormat(timestamp,' hh:mm:ss tt') ##tab#
#FirstName##tab#
#LastName##tab#
#Address1##tab#
#Address2##tab#
#City##tab#
#State##tab#
#Postal##tab#
#replace(get_Data.Comments,Chr(13),"", "all")#
#carriage#</cfoutput>