How to export data to an excel by preserving styles

Hi All,
I am trying to export data to an excel using ColdFusion. Below is my code.
<cfheader name="content-disposition" value="attachment; filename=dashboard.xls">
<cfcontent type="application/msexcel">
<table width="200" border="1">
  <tr>
    <td width="40"> </td>
    <td width="160">
      <table width="160" border="1">
      <tr>
        <td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td><td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td>
        <td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td><td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td>
      </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="40"> </td>
   <td width="160">
      <table width="160" border="1">
      <tr>
        <td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td><td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td>
        <td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td><td width="20" bgcolor="red"> </td><td width="20" bgcolor="black"> </td>
      </tr>
      </table>
    </td>
  </tr>
</table>
When I try to execute above code by commenting <cfheader><cfcontent> then the output is perfect. styles are preserved. And when I uncomment <cfheader><cfcontent> and execute code, then an excel file will get open. But all the styles are lost. So how to preserve all styles(table width etc.) in excel.
Can anybody please assist me on this. Thanks in advance.
Regards,
Manoz.

I copied your code and did the test. Result: no problem.
However, I used the following table data in my test. Did you use any data in yours? To fully test an HTML table, you have to put in some data.
<!--- <cfheader name="content-disposition" value="attachment; filename=dashboard.xls">
<cfcontent type="application/vnd.ms-excel"> --->
<table width="200" border="1">
  <tr>
    <td width="40">xxx</td>
    <td width="160">
      <table width="160" border="1">
      <tr>
        <td width="20" bgcolor="red">AAA</td><td width="20" bgcolor="black">ccc</td><td width="20" bgcolor="red">eee</td><td width="20" bgcolor="black">ggg</td>
        <td width="20" bgcolor="red">&n b s p;</td><td width="20" bgcolor="black">ddd</td><td width="20" bgcolor="red">fff</td><td width="20" bgcolor="black">hhh</td>
      </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="40">yyy</td>
   <td width="160">
      <table width="160" border="1">
      <tr>
        <td width="20" bgcolor="red">111</td><td width="20" bgcolor="black">333</td><td width="20" bgcolor="red">555</td><td width="20" bgcolor="black">&n b s p;</td>
        <td width="20" bgcolor="red">222</td><td width="20" bgcolor="black">444</td><td width="20" bgcolor="red">666</td><td width="20" bgcolor="black">888</td>
      </tr>
      </table>
    </td>
  </tr>
</table>
Two other things to note. First, I have used &n b s p; for empty table-data. Secondly, though the MIME type you have used for excel might work, the correct  value is application/vnd.ms-excel.

Similar Messages

  • How to export data to an excel file using VBScript

    I'm trying to create a VBScript in DIAdem (V9.1) which automatically saves all the current channels in the data portal to an excel file. I've tried using 'Call ExcelExport' and specify a full file path but the file is never created. What am I doing wrong?
    Thanks,
    Steve

    Hi Steve,
    There are a couple of other things you can try. If you don't like Ingo's suggestion about multiple Excel STP files, your only real option is to create an ASCII file. Note that you can give the ASCII file an extension of *.CSV or even *.XLS, and Excel will read it right in.
    So the question boils down to how to format the ASCII export correctly and quickly.
    You can use the DAT file approach Ingo mentioned and even re-write the file with VBS to include a few header lines of your own choosing. Note that this approach does NOT support text channels. There is an example of this in the zip file attached below.
    You can alternatively use the CSV export function in DIAdem 9.1 to output an ASCII file with the name of each channel as the single header row above all the values. There is an example of this in the zip file attached below.
    You can also just read the values from the DIAdem channels and write them out to an ASCII file cell by cell, managing everything with VBScript calls. There is an example of this in the zip file attached below.
    I hope that helps,
    Brad Turpin
    DIAdem Product Support Engineer
    National Indstruments
    Attachments:
    DIAdem ASCII Export.zip ‏5 KB

  • How to create an excel and how to export data to that excel ALBPM

    Hi,
    anyone can u please give me some idea to create and export the data to excel.i have creatde COM Bridge as external resource.

    I would suggest something like:
    DBAdapter --> Bpel Process --> File Adapter --> write file to location (you can write in csv which can be imported into xls)
    Read Location --> FileAdapter --> Bpel Process --> Email Activity
    Regards,
    Anshul

  • Export data CUBE to EXCEL sheet

    Hi all,
    this is Sudhakar
    can You pls help me out
    How to export data CUBE to EXCEL sheet
    but I am Excute to my Cube and I am wathcing my data but I dont know how to export data cube to excel
    ple tell me any one how to export data ASAP
    Thanks and Reagards
    Sudhakar

    Else u can use the Next button next to Excel sheet> Loacl file> there r can select it as a spreadsheet and give ur local file name..

  • How to export data to 2 tabs in excel from form with two tabs

    Hi friends
    i am now faceing a prbs of exporting data to excel to different tabs.
    ex:- i have a multiple records form with two tab . i want to export data corresponding to excel as two tabs.
    can anyone suggest me how can i export data to 2nd tab.. is any functions or procedure to help me .

    Hello,
    at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the packages behind second and fourth link support more than one worksheet. And both describe how to do it.
    Regards
    Marcus

  • How to export data in JSP to MS excel

    hi frens..
    anyone out there knows how to export data in JSP to Ms excel .. i already add this code inside my jsp..
    <%@ page contentType="application/vnd.ms-excel" %>i need to retrieve the data from the database to excel.. it's something like a report display in the excel.

    set the response type as....
    response.setContentType("application/vnd.ms-excel");
    U must be geting the data from the database...
    get the data ...
    rs=st.executeQuery(sql);
    where sql is ur query and use it as usual....

  • How to export report output into excel.

    Hi all
    how to export report output into excel sheet can any on give me answer step by step please as soon as possible
    kk

    Hi Prashanth,
    If you are executing Query from WAD  ---> Right click on Table (only on Characteristics Data)  --> Enhanced Menu ---> Export as --> CSV file or MS Excel
    assign points if this helps,
    Thanks,
    Sudhakar

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • Hyperion Web Analysis Studio - Excel Export Data PATH TO EXCEL

    I have a problem with Hyperion Web Analysis Studio by Export Data (Path to Excel) function on every client (windows Vista - IE 7 - Office 2007)
    The problem is when I try to use the Export data to Excel, the Path to the excel program is missing and I have to go manually over the directory and choose the excel.exe to export the report, when I restart the IE I have to do it again...
    Hyperion support suggested I try adding the Excel path to my webanalysis.properties file
    So I now have:
    ExcelPath=C:\\Progra~1\\Micros~2\\OFFICE12\\EXCEL.EXE;C:\\Progra~1\\Micros~2\\OFFICE12
    EXCEL.EXE
    WordPath=C:\\Progra~1\\Micros~2\\OFFICE12\\WINWORD.EXE;C:\\Progra~1\\Micros~2\\OFFICE12
    WINWORD.EXE
    PPTPath=C:\\Progra~1\\Micros~2\\OFFICE12\\POWERPNT.EXE;C:\\Progra~1\\Micros~2\\OFFICE12
    POWERPNT.EXE
    MaxDataCellLimit=200000
    XLExportMaxRows=60000
    XLExportMaxColumns=200
    ResolveDimSetAliases=false
    ExportDataFullPrecision=true
    To me this does not seem the way to go
    This did not correct my problem.
    Any ideas?
    thanks
    Erich

    Hello,
    Even we have the same issue.And changed the path in webanalysis.properties file.And it worked in entire report but in drillthru reports, export to excel 2010 didn't work and prompting to select the path to excel.Does anyone has solution for this??

  • How to export data from a Oracle table to a delimited file?

    I know how to load delimited file into a table, but how to export
    data from a Oracle table to a delimited file?
    Thanks in advance.

    Try looking at this link, it's long but there's three different solutions discussed in it. If you look at Barbara Boehmer's
    solution in her posts in the link below you'll see that she's addressed your concerns with spool files.
    Re: utl_smtp and triggers

  • How to export data from a spread sheet which has multiple work sheets?

    How to export data from a spread sheet which has multiple work sheets to a single text file with fixed length fields?

    Hello s1,
    saving them as CSV will not give a fixed legth output but, as the naming says, a Character Separated Value file.
    Regards
    Marcus

  • How to Export data from webdynpro using Jecxcel

    Hi ,
    Can anyone help me how to export data from web dynpro using Jexcel. kindly send me the related links.
    Thanks

    Hi Sandeep,
    Have you refered in the blogs?
    U can find may more document related to this.the below blog helps u in
    Exporting Data from Web Dynpro in Different Formats Using Open Source (POI, JExcel, iText) APIu2019s.
    https://www.sdn.sap.com/irj/sdn/index?rid=/library/uuid/b030e7fb-2662-2b10-0dab-c4aa52c3550b
    Regards
    Supraja

  • Export data to MS Excel in Adobe interactive form

    Hello Experts,
    I am using Webdynpro Java and ALCD 8.2.  Can anyone help me out with functionality of Exporting adobe form data to excel file.
    Thanks in advance,
    Swami

    Hi Swami,
    When you say exporting data to a excel spread sheet.
    Does that mean once the form is generated then user should able to export to excel, if so below is the link for that.
    http://forums.adobe.com/thread/709565?tstart=1
    if its like for an interactive forms where user submits data the on submit event if you want to publish the form data to a spread sheet, I believ there should be a lot of posts on generating CSV files from ABAP code. this is also possible from WDJ provided if you have the respective jar files (on submit even, read data from the context, process to required format, call the excel API and write to it.)
    If from ABAP handler the post from the other blogger here might help.
    does this help, let me know if you are looking for something more specific.
    Cheers,
    Sai

  • I need how to load data from MS Excel(csv format) to NW Excel

    Hi,
    I am doing Migration project from SAP MS to NW Manually.
    I need how to load data from MS excel (csv format) to NW excel .
    For example 2008 budget data.
    Could you please help me in this.
    Thanks and Regards
    Krishna

    Hi,
    You need to create a transformation file and a conversion file if required. First upload the excel (csv) file into BPC using Manage Data and Upload File option.
    Create the transformation file (refer to the sap help  on how to define a transformation file). You need to specify the mapping correctly and include all your application dimensions and map them to appropriate columns of the flat file.
    Before running the import package, do validate the data in the flat file you uploaded into BPC with the transformation file you created.
    Thanks,
    Sreeni

  • How to export crystal report to excel through progeam

    Hi,
    Can any help me how to export crystal report to excel through program(C#). I'm using VS2005.
    Also, the report should be in a pivot table format after exporting to the excel..please help me how to do this
    Thanks,
    Venky

    Hi Venkat,
    The link below provides the code C# in an ASP.NET codebehind file
    http://www.codeproject.com/KB/cs/Crystal_Report_Export.aspx
    http://aspalliance.com/478_Exporting_to_Excel_in_Crystal_Reports_NET__Perfect_Excel_Exports.2
    Regards,
    Abhijeet  T.

Maybe you are looking for

  • Error when deploying ADF application to new WebLogic Server

    Hello, My java-free workplace is getting into ADF development. We've purchased Fusion Applications but don't have the hardware or software yet. I am trying to get a development machine set up ASAP so I can play around with ADF and later SOA Suite. I

  • Totals in Pivot table

    I have this pivot table in OBI EE. It have the base amount per year and per month. With one total per year, with sumatory of Base amount. Moth      2001 2002 2003 1 Base 4.206.068,79 4.817.526,27 4.315.587,17 2 Base 4.100.429,84 4.031.267,42 4.950.02

  • Reason for Cancellation of Invoices

    Hi,      Can any body tell me the possible reasons for cancellation of invoices ? Helpful answers will be rewared Thanks & Regards, V.Raghavender.

  • HT3500 How do I know if my epson printer is on a wifi network

    My epson printer goes off line some times when I print from my ipad

  • Third party sales at depo level

    hi,     All,can anyone explain me in detail third party sales at depo level and what is the step by step procedure......