Получение начального нуля отображается без кавычек

Я хочу удалить одиночный, но когда я удаляю его, то ведущий ноль не отображается.

Я хочу, чтобы начальный ноль отображался без кавычек.

Мой тип данных столбца varchar:

<cfquery name="getStudent" datasource="#Application.dsn#">
        SELECT CONCAT('\'',U.user_gov_id) as User_gov_id  , 
        U.user_first_name , U.user_last_name , CONCAT('\'', U.user_mobile ) as Mobile_Number  
        , U.user_address, U.user_street_number, U.user_city , U.user_post_code , 
        DATE_FORMAT(U.delivery_date, '%Y-%M-%d %h:%i:%s')  
        FROM tblUSER U INNER JOIN tblUSER_PAYMENT P ON U.user_id = P.user_id 
        WHERE P.other_amount = '250' AND U.isdelivered = 0 AND U.matrix_node_number > 155
    </cfquery>

Для генерации Excel

<cfspreadsheet action="write" filename="#fileName1#.xlsx" query="getStudent" overwrite="true" >
  <cfheader   name="Content-Disposition" value="inline; filename=#fileName1#.xlsx">
   <cfcontent  type="application/csv" file="#ExpandPath('#fileName1#.xlsx')#" deletefile="yes"> 

1 ответ

Отформатируйте столбец как текст, прежде чем писать электронную таблицу. В следующем примере столбцы 2 и 3 отформатированы как текст.

<cfscript>
    format={};

    format.date={};
    format.date.dataformat="mm/dd/yyyy";

    format.text={};
    format.text.dataformat="@";

    var theSheet=SpreadSheetNew("OutputSheet");
    SpreadsheetAddRow(theSheet,ArrayToList(query.getColumnNames()));
    SpreadsheetAddRows(theSheet,query);
    SpreadsheetFormatColumn(theSheet,format.text,2);
    SpreadsheetFormatColumn(theSheet,format.text,3);
    SpreadsheetFormatColumn(theSheet,format.date,6);
</cfscript>


<cfspreadsheet  action="write"
                filename="#ExpandPath(filename)#"
                name="theSheet"
                sheet="1"
                sheetName="Sheet 1"
                overwrite="true">
Другие вопросы по тегам