collumm names from DB to Excel

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default collumm names from DB to Excel

    I manage to download data fields from the Database in to an Excel file. Now i
    would like to have the collomm names downloaded as well. Here is the code i'm
    currently having. I <cfquery name='laden' datasource='issue'> SELECT * FROM
    tbl_issue ORDER BY issue_number ASC </cfquery> <!--- set vars for special
    chars ---> <cfset TabChar = Chr(9)> <cfset NewLine = Chr(13) &amp; Chr(10)>
    <!--- set content type to invoke Excel ---> <cfcontent
    type='application/msexcel'> <!--- suggest default name for XLS file ---> <!---
    use 'Content-Disposition' in cfheader for Internet Explorer ---> <cfheader
    name='Content-Disposition' value='filename=issue.xls'> <!--- output data using
    cfloop &amp; cfoutput ---> <cfloop query='laden'>
    <cfoutput>#laden.issue_number##TabChar##laden.inte rnal_nr##TabChar##laden.region
    ##TabChar##laden.channel##TabChar##laden.issue_typ e##TabChar##laden.vendor##TabC
    har##laden.carrier##TabChar##laden.qrb_cat##TabCha r##laden.customer_impact##NewL
    ine#</cfoutput> </cfloop>

    fluiter Guest

  2. Similar Questions and Discussions

    1. Place Excel into table with ability to link when native Excel file is updated.
      Is it possible to place an Excel file into InDesign and create a link so that any changes made later to the Excel file can be updated in InDesign? ...
    2. [PHP-DEV] Method Names
      It seems that PHP 5 treats all methods as lower case, so that text() is Text(). Is this going to remain this way? -- PHP Internals - PHP Runtime...
    3. Machine names v. User names
      Good Morning... Unfortunately one of our mainframe processes require a local machine name that is identical to the local user account name. For...
    4. [PHP] PHP, Excel, jpgraph - can the graph be included in the Excel output?
      You need a class that can create xls files with images. Or you can create a Web Archive: http://officeupdate.microsoft.com/office/webarchive.htm ...
    5. PHP, Excel, jpgraph - can the graph be included in the Excel output?
      Good morning! I have several reports that are generated using PHP & MySQL for which I would like to include a graph using the excellent jpgraph...
  3. #2

    Default Re: collumm names from DB to Excel

    Since you have the field names in your code, the easiest thing you can do is to just type them in your code right above the start of your CFLOOP.
    VillageX Guest

  4. #3

    Default Re: collumm names from DB to Excel

    If you narrow the columns in the SELECT statement to exactly what you need for
    the output (instead of *), you can include this code before the CFLOOP:
    <cfoutput> <cfloop index='thisfield' list='#laden.Columnlist#'>
    #thisfield##TabChar# </cfloop> #NewLine# </cfoutput>

    philh Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139