Format the columns for data to Excel

Hello, everyone.

I'm working on a document that runs a query, fills a < table > with data, then spits out an Excel sheet for the user to open or save. I use the equivalent CFSCRIPT of CFCONTENT and CFHEADER to create the Excel file.

Code:
  <cfscript>
    pc = getpagecontext().getresponse();
    pc.getresponse().setcontenttype('application/vnd-ms.excel');
    pc.setHeader("Content-Disposition","attachment;filename=ThisData_#DateFormat(now(),'yyyy-mm-dd')#.xls");
  </cfscript>

Everything works very well, with one exception.

The columns of the query that is returned is a varchar data type (10) - data is a value of "month year" as "May 2010" or "June 2011".» If you look at the data in a browser, it appears in this format ("month year"). But when the Excel file is created, it appears under the name 'May 12' or 'Dec-12 "(regardless of the month, the date is always 12).

I'm sure it's because in Excel, the column is formatted as "Général" when I need her to be 'text '. Is there a way to tell CF that needs a particular column in Excel to fit a particular way?

Thank you

^_^

This can help some:

http://support.Microsoft.com/kb/260239

Basically, if you are not using a solution of 'good' and exit

HTML, give advice to Excel on how to display things.

Tags: ColdFusion

Similar Questions

  • How to list the columns for a view

    Dear experts

    I know how to list the columns in a table. This easy by querying the data USER_TAB_COLUMNS dictionary.

    But my problem is how to issue a query that returns the columns for a view?

    Thanks in advance

    USER_TAB_COLUMNS stores the metadata for both views.

    Select * from user_tab_columns where table_name = 'YOUR_VIEW_NAME"of order of column_id.    -Replace with your view_name (mandatory course)

    See you soon,.

    Manik.

  • You use windows vista Ult; Impossible to format the dvd for backup, do not know dvd is in the drive. able to read DVDs

    You use windows vista Ult; Impossible to format the dvd for backup, do not know dvd is in the drive.  able to read other DVDs

    Hi, Virgil,.

    1. what kind of DVD are you trying to format (DVD + R or DVD + RW)?

    2. you receive messages or error codes when you try to format the drive?

    You can check if you are able to format the DVD in another computer.

    You can also read the following article and check:

    Format a CD or DVD

  • Speed up the transfer of data from Excel

    Hey!

    In my VI, I need the contents of 3 Excel files. The VI then takes in the filter criteria and uses them to filter all the data and produce graphs. Problem is that all 3 Excel files are more than 8000 lines deep and wide of 40 columns. She takes super long to get the data from one of these worksheets, nevermind 3.

    IM only starting this project, so I wanted to find the best way to address the issue.

    Is it possible to quickly transfer all the data from Excel to LabVIEW?

    If I read once and then writes it to a binary file for quick access, which would be better?

    I'm under that LabVIEW 2009 on Windows XP with report generation tool installed too.

    Rkll!

    Then this is the case you have seen either

    This

    http://zone.NI.com/DevZone/CDA/EPD/p/ID/2231

    or

    This

    http://zone.NI.com/DevZone/CDA/EPD/p/ID/3409

    ?

  • How to specify the width of the column for classic report in 5 Apex?

    5 apex, I click on the name of the report in tabular form and then go to the tab report attributes.  When you look at the attributes column, there is a list of the database columns that are included in the report.  One of the attributes is the column width.  Regardless of the value, as I type, the column widths do not change when you view the results of the report.

    For a particular column of data in the report, which is editable, this is show only about 20 characters and I want to show him perhaps 50 characters.  It would be great if it would also wrap up the value of a new line when the size of the data is too large to fit in the allotted space.

    I guess that it is a simple setting and I looking in the wrong place.

    Help, please.

    Thank you

    Kim

    Hi Kim

    Bakhtiyar post is the correct answer.  However, there are occasions where does not display the width option in the attributes Panel. that was the position that I assumed you are in.  It depends on how the form of tables was created.  If it was created using the wizard, no problem.  If the form has been created manually (IE without using the Wizard), and then depending on the model used, the width option does not appear.  The only way we found it is to recreate the form (using the Wizard).  Or use the css above.

    I hope that your form displays the width option.

    Concerning

    Paul

  • The checkbox in the column DB data record

    Hi all

    I created the article P1_checkbox (several checkboxes) using LOV(Select ename, empno from emp). Now when I checked the boxes, I want to INSERT these boxes given in the table in database 'emp_selected'.

    So when I log in again application, the boxes have pre-selected data of "emp_selected" boxes unchecked the 'emp' table and when I uncheck some preselected check boxes and check the new boxes, it should be updated accordingly in "emp_selected".

    My APEX oracle version is 4.2.

    Thank you

    Found the solution. Marking the link for others who may have doubts about the same subject.

    Oracle11g - box record data in a column DB - Stack Overflow

  • color of the column for multiple reports

    Hello

    I created a page with several classic reports. Each report has a pass called "Total". I would just pass Total in all the reports of colors.

    I added the html header

    < style type = "text/css" >

    #one td [header = "Total"]

    {color: blue ;}}

    < / style >

    I have different static IDs for all reports. for this I must repeat as below

    < style type = "text/css" >

    #one td [header = "Total"]

    {color: blue ;}}

    #two td [header = "Total"]

    {color: blue ;}}

    ....

    < / style >

    Is there another way to achieve this goal of 20 reports at the same time?

    Thank you

    KJ

    KJChellam wrote:

    Hi, AEC,.

    I use Apex 4.2.5 in Oracle 11 g.

    I tried without the static ID, now the color does not appear in the data in the column. It's "TOTAL". Sorry I typed below.

    The only reason why I can think of for that do not work, it is that the color of the column is defined by a pre-existing rule of theme with a specificity that is higher than the attribute selector. Try

    td[header="TOTAL"] {
      color: blue !important;
    }
    
  • Add/change the columns of data type (scripting)

    Hello

    I am writing a script to add default columns and their values in tables. So far, for me, it is possible to add columns to an existing table in the model.

    Then, I want to add value to the data type. I discovered there is a method called getDataType(). So far, I have not found the "setter; for this property.

    Like other scripts, I started by creating a table with columns, and then using the API to read the values.

    A simplified version of my code:

    get the columns of table

    myTab var = model.getTableSet () .getByName ("T_POSITIONS");

    colArray = myTab.getElementsCollection () .toArray ();

    loop through columns

    for (i = 0; i < colArray.length; i ++) {}

    the type of var data = colArray [i] .getDataType ();

    model.getAppView () .log (colArray [i] + "a datatype" + dataType);

    colArray [i] .setDataType ("VARCHAR2 (1)");

    }

    An error occurs when I want to run this script: could not find setDataType function in the object ID.

    I can't find the right method to add/change the datatype property.

    Any information would be appreciated.

    Hi Bart,.

    Here's what's in the column in the XML file:

    
    FDB11R21
    EMPLOYEES
    FIRST_NAME
    
    2015-01-13 12:45:08 UTC
    First name of the employee. A not null column.
    HR_870
    true
    false
    1
    LOGDT024
    20 BYTE
    false
    
    

    20 BYTES

    If you need set the size in "20 BYTE" or "20 CHAR".

    Philippe

  • Now that the definition of the columns for this result?

    I have a table with two columns. A column is a column HolidayCode and varies from H1 - H20, the next column is the column DateDeparted.

    The rules, which I want to apply are that you can't have the same HolCode with the same DateDeparted, for example H1 - October 12, 2001, H1-12-Oct-2001.

    However the same HolCode can be used with a different date, and the same date can be used with different HolCode.

    How it is after a single entry and cannot be entered again?

    Thanks for your help!

    Create [url http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses002.htm#SQLRF01111] composite unique key on the columns.

  • How to set the content of the column for lines of automatic separation

    Hello guys,.

    I have a problem with the column width and the content of column in a standard report. In the report are hugh entries that are not interrupted by a space character. I put my column width to a special value by usingen "style css: display block; Width: 300px; ». Now the problem is that some of the entries in the column with a longer width that the column width is set. Then they overlock the entries in the column next to them.

    My question is: How to set the column lines of automatic content break after a certain number of characters?

    After searching for a couple of websites and discussion thread, I found maybe a reference to the solution. I hope that it helps you to give me an answer.

    A4 FORMAT LAST_NAME COLUMN
    */*

    concerning

    wderr

    Wderr,

    It is more a matter of HTML as a matter of APEX... You can start by looking here:
    http://www.456bereastreet.com/archive/200704/how_to_prevent_html_tables_from_becoming_too_wide/

    Kind regards
    Dan

    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • The ADF table data to Excel or PDF

    Hi all
    I want to export some ADF data to Excel or PDF. I used the export action listener collection. It allows only to export data from table to Excel. Its ok, but in some tables I have columns that contain data such as 0123 (i.e. with leading zeros.). In this case, when I export to excel, these zeros are not displayed in excel. Is there a way I can avoid this problem. If this is not the case, is it possible to get the data in table adf to PDF?

    Thank you very much.

    Same problem in mycase (excel). I managed to solve this nonprintable character adding at the and of the outputText value.
    Here is my code:

    
      
    
    {code}
    
    My non-printing character... hold down alt key and on numeric keyboard part enter 255.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    
  • Write equations on the front for data acquisition

    Hello

    I was wondering if its possible while a VI is running for:

    1. Write an equation custom on the façade.
    2. Use the equation on data acquired since the VI is running.
    3. Draw the calculated data.

    See you soon

    I think you should take a look at the examples (help > find example... > tab "search" > try with formula or equation), it is one that shows in a simple way, look here: C:\Program NIUninstaller Instruments\LabVIEW 2011\Examples\measure\maxmpl.llb\Waveform Formula.vi using generation

    hope this helps

  • Oracle will consider the creation of a day 2 hands on the documentation for Data Guard?

    Hello

    Oracle will consider the creation of a documentation of son of hands 2 day for Data Guard?

    There is already an OTN 2 day of CARS and performance tuning documentation.

    Thank you

    Updated - she sent the link to this topic for the Product Manager Data Guard.  As a result, Oracle may or may not consider creating 2 days hands on Data Guard documentation, but no doubt they consider at least considering creation day 2 hands on the Data Guard documentation.

  • How can I update the column based date?

    Hello..

    first I want to thank everyone for the help that you are given...

    I have a table that looks like this:

    the air course date

    ----------------------------------------------------

    X 0 NOV2013

    Y 900 OCT2013

    Z 800 OCT2013

    X 700 OCT2013

    Y 500 NOV2013

    X 100 NOV2011

    X 200 NOV2012

    ---------------------------------------

    I need a SQL expression for this

    ---------------------------------------

    If the price is 0

    then select the average price for the same air, and the same month but different year

    ------------------------------------

    for example in the table...

    When noncompliance X is 0 to DATE price NOV2013

    THEN select the average price for product X in NOV2012 NOV2011 AND

    THAT will be (100 200) = 100

    --------------------------------------------

    Naïve...

    Hello

    This?

    Note: I pushed since your unique records PROD, D

    SQL > select * from t1;

    D PRICE OF PROD

    ---- ---------- -----------

    X 0 01.11.2013

    Y 900 01.10.2013

    Z 800 01.10.2013

    X 700 01.10.2013

    Y 500 01.11.2013

    X 100 01.11.2011

    X 200 01.11.2012

    7 selected lines

    SQL >

    SQL > select q1.prod, q1.price, q1.d, avg (q2.price) avg_price

    2 from t1 t1

    3 join left t1 t2

    4 on q2.prod = q1.prod

    5 and trunc (q2.d, 'yyyy')! = trunc (q1.d, 'yyyy')

    6 and to_char (q2.d, 'mm') = to_char (q1.d, 'mm')

    Group 7 by q1.prod, q1.price, q1.d

    8.

    PROD AVG_PRICE D PRICE

    ---- ---------- ----------- ----------

    X 700 01.10.2013

    200 X 01.11.2012 50

    X 0 01.11.2013 150

    Z 800 01.10.2013

    Y 900 01.10.2013

    Y 500 01.11.2013

    X 100 01.11.2011 100

    7 selected lines

    SQL >

    SQL >

    SQL >

    SQL > fusion in t1

    2. using (select q1.prod, q1.price, q1.d, avg (q2.price) avg_price

    3 T1 t1

    4 join left t1 t2

    5 on q2.prod = q1.prod

    6 and trunc (q2.d, "yyyy")! = trunc (q1.d, "yyyy")

    7 and to_char (q2.d, 'mm') = to_char (q1.d, 'mm')

    q 8 group of q1.prod, q1.price, q1.d)

    9 on (q.prod = t1.prod and t1.d = q. at)

    10 when matched then

    11 update set t1.price = q.avg_price where t1.price = 0

    12.

    1 row merged

    SQL >

    SQL >

    SQL > select * from t1;

    D PRICE OF PROD

    ---- ---------- -----------

    X 150 01.11.2013

    Y 900 01.10.2013

    Z 800 01.10.2013

    X 700 01.10.2013

    Y 500 01.11.2013

    X 100 01.11.2011

    X 200 01.11.2012

    7 selected lines

    SQL >

    ----

    Ramin Hashimzade

  • Can not find the plugin for data recovery?

    Hi guys,.

    I don't have the time to investigate this, but I was wondering if you can get started me.

    I installed vCenter4 and have only 1 host ESX 4 up to now (ESX4i).

    I attributed an enterprise of this machine license.

    I can't see the plugin for recovering data anywhere in my vCenter.

    What Miss me?

    I'm going through the documentation as we speak. Thank you



    Please consider my response as 'useful' or 'proper' marking

    Have you downloaded vDR from the download page where you went to get vCenter/ESX 4.0? Once installed, you will need to go to the Plug-ins and download/activate the plugin. This is at least the case for VCB, VUM, etc..

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    http://Twitter.com/lamw

    If you find this information useful, please give points to "correct" or "useful".

Maybe you are looking for