0

I am trying to create an excel file of sport scores using and but any score that is less then 13 is interpreted as a date. [eg. 15-25 is fine but 12-25 is inserted into the excel file as the date "25-Dec"]

Can someone please help me out of this dilemma.

Thank you

The summary of the Cold Fusion code looks something like this:

<!--- Code to output to EXCEL

<cfheader name="Content-Disposition" value="inline; filename=CHRVAResults.xls">
<cfcontent type="application/vnd.msexcel">

End Code to output to EXCEL --->


<table border="1" cellspacing="0">
<tr>
<td width="200" align="" class="poolHR">Team 1</td>
<td width="200" align="" class="poolHR">Team 1 Code</td>
    <td width="200" align="" class="poolHR">Opponent</td>
    <td width="200" align="" class="poolHR">Opponent's Code</td>
    <td width="300" align="" class="poolHR">Tournament Name</td>
    <td width="100" align="" class="poolHR">Date</td>
    <td width="50" align="" class="poolHR">Outcome</td>
</tr>

<cfoutput query="listDetail">

    <cfquery name="getwinningTeamName" datasource="#juniordb_sql#">
        select teams.teamName, teams.teamCode
        from teams
        where teams.teamcode = '#listDetail.Winning_teamID#'
    UNION
        select outofregion.teamName, outofregion.teamCode
        from outofregion
        where  outofregion.teamcode = '#listDetail.Winning_teamID#'
    </cfquery>

    <cfquery name="getlosingTeamName" datasource="#juniordb_sql#">
        select teams.teamName, teams.teamCode
        from teams
        where teams.teamcode = '#listDetail.Losing_teamID#' 
    UNION
        select outofregion.teamName, outofregion.teamCode
        from outofregion
        where outofregion.teamcode = '#listDetail.Losing_teamID#'
    </cfquery>

    <cfquery name="getTourn" datasource="#juniordb_sql#">
        SELECT uniqueid, dte, tournname, division
        FROM sanction
        <cfif tournID is not "">
        WHERE sanction.uniqueid = '#tournID#';
        </cfif>
</cfquery>

<td>
....etc
CNE
  • 63
  • 1
  • 7
  • Prepend your scores with ' – Tim Williams Jan 08 '17 at 21:43
  • Thanks Tim but prepending with anything will cause issues with the program that will be using the file. I simply want to generate the file with CF and then pass it on to the program that needs to use it without having to modify by search and replace. – CNE Jan 08 '17 at 22:05
  • 1
    You can use css to tell Excel to treat the cell content as text: http://stackoverflow.com/questions/23921151/default-numeric-format-in-excel/23922057#23922057 – Tim Williams Jan 08 '17 at 22:16
  • Yep. Since you are really generating HTML, you must use css to instruct Excel to treat the value as text, instead of guessing the proper format. See the example on the linked threads. – Leigh Jan 09 '17 at 00:12
  • 1
    Thank you Tim and Leigh. The style='mso-number-format:\@' works like a charm! – CNE Jan 09 '17 at 00:13

0 Answers0