CFCONTENT outputing to Excel issue

          Hi folks, 
I have a simple process that does a query and uses CFCONTENT to output a CFTABLE to a content type of "application/msexcel".  Now this works fine 90% of the time.  But I can reproduce a problem where it doesn't quite work as expected, when querying certain records. When this works,  the user gets the file downloaded to them and they open it and they see their data.  But with certain query results, the excel file opens and appears to be blank, but if you scroll down to like line 2000 you will see the embeddded HTML output for the CFTABLE with all the data.  Like this:
<table border><tr><th>ID</th>.....
That's in the Excel file in place of just the outputed data.
Because I can reproduce it with the same query over and over, I know it's likely something in the data like an extra quote or something like that, which is throwing off CFCONTENT.   Now, I can't control the data so I'm looking for suggestions for how I can wrap the data inside a CF Tag to preserve the output.
Any ideas?  I don't have access to CF9/10 or I would explore CFSPREADSHEET.  I have CF8.  Thanks
My code is quite simple, basically like this:
<cfcontent type="application/msexcel">
<cfheader name="Content-Disposition" value="filename=Export.xls">
<cfquery datasource="#DS#" name="Getdata">
select * from tablewhere practiceid = #practiceID#
order byName
</cfquery>
<cftable query="getdata" htmltable="yes" colheaders="Yes" border="yes">
<cfcol header="ID" text="#ID#">
<cfcol header="First Name" text="#firstname#">

Next time you encounter this, bear in mind that all <cfcontent> does in this case is to set the HTTP response MIME type header, which gives the browser guidance as to how to handle the data it receives.  It does not transform the data in any way.  So if you're using <cftable> (why?  Oh why?) then your're sending HTML and telling the browser it's XLS data.  Leaving it up to Excel to make sense of it (which it will kinda do, if the HTML it tidy).
If you are getting unexpected results, just do what you'd - hopefully - normally do: look at the data you're sending back to the browser, and try to work out where it's going wrong.  I presume in this case there was a tonne of white space generated by <cftable> for some reason.
In general if you want to set the MIME type for the response, get the data you want to send back ready (ie: put it in a variable), then call <cfcontent> with both the TYPE and the RESET attribute, then output the data.  This will mitigate some (although not all) of whitespace CFML churns out as part of "doing business", leaving only the data you actually want in the output buffer.
Adam

Similar Messages

  • Output in Excel Format Issue

    Hi all,
    I am not able to view the output in EXCEL format after registered the RTF file in the XML Publisher Administrator to run as a concurrent program.
    I am wokring in XMLP 5.6.2 and Microsoft Office 2003.
    When i preview the output as EXCEL in the options before run the conc. program, i have the following error msg and also when i view the output,it shows the output in some htm tags format not in EXCEL Format.
    java.sql.SQLException: No corresponding LOB data found : SELECT FILE_DATA, DBMS_LOB.GETLENGTH(FILE_DATA), FILE_NAME, LAST_UPDATE_DATE FROM XDO_LOBS WHERE LOB_TYPE = :1 AND APPLICATION_SHORT_NAME = :2 AND LOB_CODE = :3 AND LANGUAGE = :4 AND TERRITORY = :5 at oracle.apps.xdo.oa.schema.server.XdoLobsInputStream.<init>(XdoLobsInputStream.java:108) at oracle.apps.xdo.oa.schema.server.LobHelper.getLob(LobHelper.java:877) at oracle.apps.xdo.oa.schema.server.LobHelper.getBlobDomain(LobHelper.java:912) at oracle.apps.xdo.oa.template.server.TemplatesAMImpl.processTemplate(TemplatesAMImpl.java:2053) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:189) at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:152) at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:721) at oracle.apps.xdo.oa.template.webui.TemplateGeneralCO.previewTemplate(TemplateGeneralCO.java:741) at oracle.apps.xdo.oa.template.webui.TemplateGeneralCO.processRequest(TemplateGeneralCO.java:158) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:581) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1095) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353) at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2298) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1711) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418) at oa_html._OA._jspService(_OA.java:88) at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119) at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417) at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267) at oracle.jsp.JspServlet.internalService(JspServlet.java:186) at oracle.jsp.JspServlet.service(JspServlet.java:156) at javax.servlet.http.HttpServlet.service(HttpServlet.java:588) at oracle.jsp.provider.Jsp20RequestDispatcher.forward(Jsp20RequestDispatcher.java:162) at oracle.jsp.runtime.OraclePageContext.forward(OraclePageContext.java:187) at oa_html._RF._jspService(_RF.java:102) at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119) at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417) at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267) at oracle.jsp.JspServlet.internalService(JspServlet.java:186) at oracle.jsp.JspServlet.service(JspServlet.java:156) at javax.servlet.http.HttpServlet.service(HttpServlet.java:588) at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456) at org.apache.jserv.JServConnection.run(JServConnection.java:294) at java.lang.Thread.run(Thread.java:534).
    please post your comments to solve this issue.
    Regards
    Prabu

    Prabhu
    adding to above post
    first fix -- No corresponding LOB data found
    then follow the steps in below post for excel output
    Excel output in EBS?

  • Issue in output of excel

    Hi All,
    In xml file the german letters are printing proper way.
    come to excel output.. in place of german letters it shows junk characters.
    Even I checked thru xml publsiher desktop tool the output is printing well.
    Issue: The german letters are not printing well but xml is generated with german letters..
    I think it might be issue with printing thru apps
    is there any thing related to FONT in RTF?
    Please any one can help me in this..
    Thanks

    Hi Ananth,
    Thanks for quick reply.
    I gone thru the link, but I did not get much information..
    in xml the data is like: MÜNCHEN ---- showing perfect in XML as same as DB
    in Excel it is showing as: MÃ?NCHEN.----- problem in output in EXCEL
    Please help me out.
    Thanks,
    Edited by: user633508 on Dec 1, 2010 7:00 PM
    Edited by: user633508 on Dec 1, 2010 7:01 PM

  • XML Report Excel Output exponential value issue

    Hello All,
    While working on XML Report we need to show output in excel format. One of the out put value is “00110E001”. but when displaying in excel is shows "1.00E+0" and default behavior of MS Excel is if the any number data contains “E” then excel will convert those records in exponential format. But our client required those data which are present in database i.e. “00110E001”.
    Kindly share your valuable inputs.
    Thanks in advance
    Thanks,
    Pushpal

    Hi Uday,
    You are making number as a string, by adding a character :) , so it will be displayed as string with space and not as number.

  • Are You All Able to get the Output In EXCEL Format

    Hi All,
    I have one question. Are You All Able to get the Output In EXCEL Format?? I am working on Oracle Apllication 11.5.10.2 and my XML builder is 5.0.1. Problem which i m facing is this...... Whenever i am submitting a concurrent program with format type different from PDF i could not able to view the ouput in desired format. When i am pressing view output it gives me a file in XML and when i save that file with extention 'xls' or 'rtf' then i could able to see the saved file in desired format.
    Can anyone tell me where is the problem??? Is it a bug?
    I am using microsoft world 2000 sp-3.
    Please give your valuable comments. May be your comments can solve my problem..
    Thanks
    Ravi

    Hi I got Same issue
    When I change Format to EXCEL from
    Submit request>> Option>> Format = EXCEL
    In window I am getting something HTML code and
    when I try to copy it to Browser from Tools>> Copy File in to Browser I am getting following message
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End tag 'p' does not match the start tag 'a'. Error processing resource 'http://our url.com:8000/OA_CGI...
    <p class="c0"><a name="Text4" id="Text4"><a name="Text1_1" id="Text1_1"><span class="c1">Dept No <...
    But I can see the output when Format is PDF
    Pls suggest solution ,I am using EBS 11.5.10.2.
    Thanks
    Rahul
    Message was edited by: Rahul
    user576181

  • XML Publisher report default output in Excel format.

    Hi,
    We have defined one concurrent program whose output format is text, this concurrent program executable is PL/SQL and in this PL/SQL program we are generating XML data and displaying XML using below fnd_request.
    l_conc_id := FND_REQUEST.SUBMIT_REQUEST('GMP','GMPPDROP','', '',FALSE,
         p_sequence_num,chr(0),'','','','','','','','','','','',
    We have also defined template for this.
    Using below fnd_request we are choosing template and data is getting generated in PDF format. Now our requirement is to display the output by default in Excel format.
    FND_REQUEST.SUBMIT_REQUEST('XDO','XDOREPPB','', '',FALSE,'',
    l_conc_id,554,G_comb_pdr_temp,
    G_comb_pdr_locale,'Y','RTF','',scale_report,'','','','','',
    When i saw XML Report Publisher concurrent program, there is one parameter for Output Format and i tried passing 'Excel'/EXCEL/excel to this parameter but output is still coming in PDF format.
    FND_REQUEST.SUBMIT_REQUEST('XDO','XDOREPPB','', '',FALSE,'',
    l_conc_id,554,G_comb_pdr_temp,
    G_comb_pdr_locale,'Y','RTF','Excel',scale_report,'','','','','',
    I have also tried giving Default Output to EXCEL in template definition but this is also not working.
    Your valuable suggestions highly appreciated.
    Thanks
    Vijay

    Hi;
    What is EBS version? Please see below which could be helpful for your issue:
    Changing Output Format to RTF or Excel in XML Publisher Request Does Not Display Output Correctly [ID 404512.1]
    Cannot View BI Publisher (formerly XML Publisher) Report Output In Excel Format or XHTML [ID 359875.1
    How is Default Output Type Determined for Reports Submitted Using XML [ID 888972.1]
    Also see:
    XML PUBLISHER report in Excel out put problem
    XML PUBLISHER report in Excel out put problem
    Regard
    Helios

  • Report output in Excel

    Hi,
    I am stuck in an issue and need some guidance.
    I have developed a paper report in 10g. I modified the web source and added a frame to display the report in web browser.
    I updated the web source as below to display the output in excel format.
    <%@ page contentType="application/vnd.ms-excel;charset=ISO-8859-1" %>.
    I tried to set
    desformat = SPREADSHEET and delimited both.
    I can see the report in web browser; however I am not able to display it as EXCEL format.
    Please guide me.
    Regards
    Satya

    Hello Satya,
    application/vnd.ms-excel is the MIME type for a binary (proprietary) format that MS uses as default up to version Excel 2000. desformat = SPREADSHEET does not create a binary file, but a representation of the data in a tabular format.
    I am not able to display it as EXCEL formatOracle Reports cannot generate any format defined by Microsoft. For options how to generate "Excel" files see {message:id=9360007}.
    Regards
    Marcus

  • Reports - output to Excel - does not format the "Broken by" rows correctly

    Choosing the "break by" column clause while building one of the
    wizard based reports works great when you are displaying the
    reports in the default HTML mode.
    So, my query actually returns a denormalized return set with
    multiple rows containing the same fields on certain columns.
    This works great with the default format, since the repeated
    fields/rows are nulled and I get a neat report.
    However, the same thing, if I choose to output in excel, I get
    the original denormalized output into the excel document instead
    of the null fields for the duplicate fields/columns
    It looks like it sends the result set directly to the excel
    before allowing the Report UI formatting to take effect. This
    is a big issue for us, since we promised the client that we
    could get them excel outputs easily, when it does not really
    work the way you would expect it.
    Any suggestions ??
    regards
    -Ananth

    Ananth,
    Presently, this is not supported. It is targeted for some future
    release. This is a known bug. If you want the bug number then
    mail me as it can not be posted here (It is unpublished bug).
    Thanx,
    Chetan.

  • Reg: ALV Output to EXCEL

    Hi
    i am working in a alv report and i got the output and when i download in to excel some of the columns getting mismatched..
    I got some solution from theSDN have to do some modification in Excel sheet,But now i am using EXCEL 2007 version can any one gimme some logice how to come out of this issue??
    Thanks and Regards,
    Arun Joseph

    Arun,
    some time when you download output to excel than may be some of the field or sorting critieria may be not reflect in excel so you need to do some adjustment even you are using excel2007.
    Amit.

  • ALV GRID OUTPUT to excel

    Hi,
    I am facing a issue like when i am selecting columns of grid output and pressing microsoft excel button ,it is opening a blank excel sheet but it is not showing any data in excel sheet ,pls tell how i can get data in that excel sheet ,what else code i have to write.
    sag

    Gud,
    Open up Excel on your desktop.  Goto Tools > Macro > Security.
    Make sure that your security is set to Medium (or less).  SAP uses OLE automation to run the Excel instance and in Office 2003 (for example), Microsoft has increased their default security setting to High.  With the High setting, the output to Excel fails.
    Was this your problem?  Don't forget those points, either.

  • Problem in Download ALV Output to Excel

    Hi All,
    When iam going to Download the ALV ( Grid ) Output to Excel, all columns are not coming in Output.
    But the ALV Output Contains 140 Columns.
    How to solve this issue.
    Points Rewarded.
    Thanks & Regards,
    Kiran . I

    Hi,
    You can download the report by going to menu option
    List->export->local file.. in this select spreadsheet and give the name for this to download.
    You can view all the columns here in xls sheet.
    Regards,
    Ram Mohan
    Pls reward poins if useful...

  • Setting filename sending output to Excel form servlet

    Hi All
    I am successfully sending my tab separated output to Excel from the servlet using the following:
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition","inline;filename=statistics.txt");
    The output is automatically opened in a new window using excel.
    However the sheet in excel is named based on the url of the servlet it came from, not statistics as i have specified. The main issue with this, apart from the niceness of it, is that if the user then generates another excel output from the same servlet then the new file is not loaded as excel already has a file by that name open and can't handle duplicate names.
    I have seen many references to this syntax, but it doesn't quite work for me.
    I hope someone can clarify what i am missing here.
    Thanks in advance.

    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;
    import java.io.IOException;
    * @author Ravi Desu (rdesu)
    * @version 1.0
    * $Id: ExcelGen.java, Jun 1, 2004 4:43:13 PM rdesu Exp $
    public class ExcelGen extends HttpServlet {
    protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
    HSSFWorkbook workbook = new HSSFWorkbook();
    HSSFSheet sheet = workbook.createSheet("Worksheet 1");
    HSSFRow row = sheet.createRow((short) 0);
    HSSFCell cell = row.createCell((short) 0);
    cell.setCellValue("This is text in a cell");
    httpServletResponse.setContentType("application/vnd.ms-excel");
    workbook.write(httpServletResponse.getOutputStream());
    In your web.xml:
    <servlet>
    <servlet-name>ExcelGenSrvlt</servlet-name>
    <servlet-class>ExcelGen</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ExcelGenSrvlt</servlet-name>
    <url-pattern>/ExcelGen.xls</url-pattern>
    </servlet-mapping>
    download the org.apache.poi jars from
    http://www.apache.org/dyn/closer.cgi/jakarta/poi/
    http://jakarta.apache.org/poi/

  • I want the ebs report to give me an output in Excel

    i am a bit new i can only view txt and pdf files as output from my ORACLE ERP.
    I am able to change the file in the concurrent request definition window to XML but when i run the report from my HRMS resp. it gives me TAGS and not the output in excel.
    Kindly help me with some document so that i can acheive my goal.
    thanking you all in advance!

    You need to use XML publisher and create a RTF template to format the data in Excel.
    Outputting Oracle to Excel is always cumbersome, you can use XML Publisher (BI Publisher), Discoverer and bunch of other tools. The only problem with them is that you have to learn on how to use the specific tool, which often outweighs the benefits. Especially if your users have hard time adopting it.
    I have been dealing with this issue for many years in all the places I worked at and finally came up with an approach where you simply paste your query in the standard report definition screen in System Admin and it produces Excel outputs when run. No CSVs, no dumping files into Unix, just click on the report output to have the Excel screen open up with your report in it. The only skill you need to have is writing SQL. Other than that, no development tools are required. To my surprise my latest client migrated from Discoverer to my tool, heh.
    Check it out at:
    http://more4apps.com/demos?DemoName=EO&ProductName=Excel-Out
    If you have any issues email me at [email protected] I can do a live demo.

  • Export to Excel Issue - Background Colors

    Hi,
    I have upgraded report server from 2005 to 2008R2. I have an issue where in my code 2 separate reports are output into Excel. When this happens the background color is a random bright color such as green and yellow.
    I tried creating a new report in the same solution but I get the same issue. I also tried setting colors in report to just black & white but no change.
    I found
    this KB but does not help in my situation as no manual copy/paste.
    Any ideas? Thanks!
    string differencesFile = "myfilepath";
    Excel.Application xlApp;
    Excel.Workbook finalWorkbook;
    Excel.Workbook xlWorkbook;
    Excel.Worksheet balancesWorksheet;
    Excel.Worksheet differencesWorksheet;
    Excel.Worksheet newWorksheet;
    object missing = System.Reflection.Missing.Value;
    xlApp = new Excel.ApplicationClass();
    xlWorkbook = xlApp.Workbooks.Open(differencesFile, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
    differencesWorksheet = (Excel.Worksheet)xlWorkbook.Sheets[1];
    finalWorkbook = xlApp.Workbooks.Add(missing);
    newWorksheet = (Excel.Worksheet)finalWorkbook.Sheets.Add(missing, missing, missing, missing);
    differencesWorksheet.Copy(missing, newWorksheet);
    xlWorkbook.Close(false, differencesFile, false);

    Hi obrienkev,
    In order to trouble shoot this issue more efficiently, could you tell me what’s the function of this code you posted? What do you want to do with this code? Could you explain it more details?
    As to your issue, please try to directly export the report to Excel to check this issue again. Are you get the correct background color in the report or with the same issue? Tell us more detail information, then we can make further analysis.
    Thank you for your understanding.
    Regards,
    Katherine xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Create Output to Excel from PL/SQL

    I've created a procedure that generates an excel output. The output is generated if the number of rows are less than 850. If more than 850, I received a "Page Not Found" error.
    I used Note:132262.1 "How to Create Output to Excel from PL/SQL".
    Does anybody know a fix or workaround for this issue?

    It might be worth your time to check out owa_sylk from asktom.oracle.com. It's a pl/sql package that generates SYLK files, which Excel can then open. By using a standard file format instead of a proprietary one you get away from most of the "which version of Excel" issues.
    Scott

Maybe you are looking for

  • Mobile Me Gallery app

    Is there an app to view my Mobile Me galleries? Thanks, Ke n

  • How to load FLASH 11.

    I too have this problem since day before yesterday.  Kaspersky told me to upgrade to FLASH 11 .0.1.152 because 10.3.183.7 has vulnerabilities. (In the recent past I had problems upgrading to 10.3.183.7 from 10.3.183.5.  I was finally able to successf

  • Movement types in GR

    HELLO FRIENDS, Please give the information on movement types in GR with transaction no. Thanks

  • Publish/Send messages in JMS to be delivered after some time

    I would like to know if the JMS standards address publishing of a message to a Topic or send to a queue which becomes visible or becomes eligible for subscribers to retrieve the message after a certain amount of time. In other words I would like to s

  • ALV excel formatting

    Hi how to set in SALV some formatting in exporting to excel file. I want to convert some numbers variables to text format before will be create XLS sheet.