Vnd.ms-excel.numberformat:@

I use a cloud-computing app, Salesforce, to maintain some databases. The report module, which produces nice-looking formatted reports, allows you to export the data as .csv files, which can be opened without trouble by Numbers. It also allows you to export them (formatting intact) as .xls files, which are (according to their first line) in this vnd.ms-excel.numberformat. I recently downloaded a trial of Microsoft Office, and those files were opened without trouble by excel (formatting intact).
Is there any way to open them in Numbers so that the formatting remains? Here is a sample lines: it's obviously html code but I can't get Numbers to read it as that.
"<tr><td style=""vnd.ms-excel.numberformat:@"">xx Durst Membership Donation - 03/05/2010</td><td align=right>5.00</td><td align=right>3/5/2010</td><td style=""vnd.ms-excel.numberformat:@"">xx Durst Household</td><td style=""vnd.ms-excel.numberformat:@"">Membership 2010</td></tr>"

and which I spelt properly in the other thread.
I have a friend named Ivan, so I slipped.
My name is CLARE, not ClaIre, or Clara, or any number of other variations. My last name is DURST, not Durt, nor Dust, nor Rust. I get used to misspellings!

Similar Messages

  • WORKAROUND: "A document with the name 'vnd.ms-excel' is already open"

    I'm posting this in the hope that it might help someone else (or that someone else might suggest a better solution)...
    I'm using the technique described in the Integrating Oracle Reports in Oracle Forms Services Applications white paper. Basically, this means using RUN_REPORT_OBJECT to generate a report, and then navigating to a URL of the form...
    http://<host>/reports/rwservlet/getjobid<n>?server=<name>...to show it.
    I had the requirement that some reports (with DESFORMAT=DELIMITEDDATA) needed to open in Excel, so for these reports I added the MIMETYPE command to the URL, so that it was of the form:
    http://<host>/reports/rwservlet/getjobid<n>?server=<name>&mimetype=application/vnd.ms-excelThis appeared to work, but only for one report at a time. I could generate one report this way, and when I navigated to its URL, the report would be displayed by Microsoft Excel within a new browser window as expected. However, if I left the browser window open, then generated a second report and navigated to its URL, a new, empty browser window was displayed, but a "Microsoft Excel" message box appeared with the following message:
    A document with the name 'vnd.ms-excel' is already open. You cannot open two documents with the same name, even if the documents are in different folders.
    To open the second document, either close the document that's currently open, or rename one of the documents.
    When I chose OK (the only button), the message box closed, but the new browser window remained empty.
    If Excel was already running to begin with, the message box was obscured behind other windows, and the new browser window remained empty and appeared to never finish loading (because it was waiting for a response from the message box). The message box only appeared if I explicitly navigated to Excel (for example, using the taskbar). When I chose OK, a "File Download" dialog appeared, followed by a message box that reported the following:
    Microsoft Excel for Windows has encountered a problem and needs to close. We are sorry for the inconvenience.
    When I closed this message box, Excel shut down.
    I could not find this documented anywhere, but it appears as if Excel interprets the text after the last "/" in the URL as the file name. In my case, this was the same text every time (specifically "vnd.ms-excel"), which caused problems because Excel does not allow you to open two files with the same name.
    My workaround was simply to add the "JOBNAME=/<n>" command (where <n> is the job ID) to make the text after the last "/" unique (at least in my case). In other words, by using a URL of the form...
    http://<host>/reports/rwservlet/getjobid<n>?server=<name>&mimetype=application/vnd.ms-excel&jobname=/<n>...I was able to avoid the problem. For example, for job ID 123, the URL would be...
    http://<host>/reports/rwservlet/getjobid123?server=<name>&mimetype=application/vnd.ms-excel&jobname=/123...and Excel would interpret the file name as "123".
    Hope this helps.

    Thanks for posting, this solution worked!

  • MIME TYPE ; application/vnd.ms-excel

    HI
    i have bsp page which i have declared mime type application/vnd.ms excel the idea is to download the entire contents in local machine . when i click generate excel i get 3 buttons open ,save ,cancel. how can i capture the event open in the page .a sample code will be very helpfull
    reagrds
    Prasun

    Hi
    This is sample code need to be declared in the OnInputProcessing an event for an ID:
    data:
      w_event type ref to cl_htmlb_event,
      w_obj type ref to object,
      w_mod type ref to cl_htmlb_inputfield,
      w_module type string.
      data:
       tv type ref to cl_htmlb_tableview,
       tv_data type ref to cl_htmlb_event_tableview.
      call method cl_htmlb_manager=>get_event
      exporting
        request = runtime->server->request
      receiving
        event   = w_event.
      case w_event->id.
      when 'open'.
        call method cl_htmlb_manager=>get_data
          exporting
            request = runtime->server->request
            name    = 'inputfield'
            id      = 'module'
          receiving
            data    = w_obj.
           w_mod ?= w_obj.
           w_module = w_mod->value.
    endcase.
    'open' this open you need to declare in HTMLB  Button Tag with Option ID...in this way as soon as you click the Button OPEN the Event will be triggered
    Regards,
    Rajani

  • How to get at a mail of MIME type application/vnd.ms-excel?

    My java proggie has to deal with an email sent with Outlook '97 (don't ask me why it has to be that) and this email has the following header fields (see below). Now, my program works fine if the email has MIME type multipart/mixed. So, how do I have to do to handle an email of MIME type application/vnd.ms-excel (outline of logic or even some code snippet will be greatly appreciated)?
    Received: by chk_exchange6.whatever.local
         id <01C83718.A96E9AC0@chk_exchange6.whatever.local>; Wed, 5 Dec 2007 16:27:24 +0800
    Message-ID: <E839E45C64CF7E4D9E4E8A334B79363001F0DB62@chk_exchange6.whatever.local>
    From: "somebody" <[email protected]>
    To: "me" <[email protected]>
    Subject: excel attached
    Date: Wed, 5 Dec 2007 16:27:24 +0800
    MIME-Version: 1.0
    Content-Type: application/vnd.ms-excel;
         name="nevermind.xls"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
         filename="nevermind.xls"
    Edited by: dickensl on Dec 5, 2007 11:47 PM

    Depends on what you want to do with it.
    If you want to access the data in the Excel spreadsheet
    and make sense of it, you're going to need some
    Java classes to interpret an Excel spreadsheet.
    Good luck on that. :-)
    If you just want to save the content in a file, as if it
    were an attachment, use msg.getInputStream()
    and copy the data to a file, like this:
            OutputStream out = null;
            InputStream in = null;
            try {
                out = new BufferedOutputStream(new FileOutputStream(file));
                in = msg.getInputStream();
                byte[] buf = new byte[8192];
                int len;
                while ((len = in.read(buf)) > 0)
                    out.write(buf, 0, len);
            } finally {
                // close streams, but don't mask original exception, if any
                try {
                    if (in != null)
                        in.close();
                } catch (IOException ex) { }
                try {
                    if (out != null)
                        out.close();
                } catch (IOException ex) { }
            }

  • Application/vnd.ms-excel dropping leading 0's

    I have a jsp page that successfully displays my data in an excel window on the browser. My user then will cut and paste the data from the screen to Excel running on their desktop. My problem now is the leading zeroes are dropping off. The data being passed are String objects and are being passed as such. Is there any info regarding formatting that allows one to put a special character in the String object to keep the zeroes. I have tinkered with placing a single quote into the String and it works, but when cut and pasted to Excel running on the desktop the sinqle quote remains. I cannot find any docs that discuss how to format the cells in the browswer.
    javaembryo-
    code sample
    <%@ page language="java" contentType="application/vnd.ms-excel" %>
    <td><%=LawsonJspUtil.print( modifyRecord.getSubmitStatus() ) %></td>
    The LawsonJspUtil.print() method takes a String object, checks for null and returns a String object. If the String is null, it outputs a space to fill the column. I could use this method to properly format the column to keep the leading zeroes.

    Wrote a small program for you:
       public boolean isString(String s) {
          if (s==null || s.length()==0) return true;
          for (int i=0;i<s.length();i++) {
             if (s.charAt(i)<'0' || s.charAt(i)>'9') return true;
          if (s.startsWith("0")) return true;
          return false;
       }This little gem will return true if a string contains non-numeric digits, it will also return true if the string contains all digits but starts with a zero.
    ;o)
    V.V.
    PS: don't forget the dukes if this helps!

  • Application/vnd.ms-excel

    Hi!
    I want to display(open) an excel file from a java class but I have a problem.
    I am using the code as below:
    setContentType("application/vnd.ms-excel");
    and it works.
    The problem is that i want to visualize datas from a query.
    One of this datas is the italian CAP (postal code) that sometimes starts with 0. For examples: 09100.
    Well, excel file does not show the first zero although the field is a string,.
    someone can help me?
    Thank you!

    Wrote a small program for you:
       public boolean isString(String s) {
          if (s==null || s.length()==0) return true;
          for (int i=0;i<s.length();i++) {
             if (s.charAt(i)<'0' || s.charAt(i)>'9') return true;
          if (s.startsWith("0")) return true;
          return false;
       }This little gem will return true if a string contains non-numeric digits, it will also return true if the string contains all digits but starts with a zero.
    ;o)
    V.V.
    PS: don't forget the dukes if this helps!

  • Report won't run for mimetype=application/vnd.ms-excel

    Hi,
    My customers need to run reports in excel and type in parameters into the parameter from. The URL is:
    http://myServer/dev60cgi/rwcgi60?xyz+server=Repserv+report=rptName.rdf+destype=cache+paramform=yes+desformat=delimited+mimetype=application/vnd.ms-excel
    The parameter from shows up and all the LOVs are there, the reset botton works, the Submit Query botton only shows Submit (NO QUERY). The report won't run when I click on Submit botton.
    But it works perfectly if no mimetype=application/vnd.ms-excel in URL
    Can anybody help me to fix this ?
    Thanks

    The mimetype parameter was only introduced in 6.0.8.10 and above. What version are you running ?
    Thanks,
    Danny

  • OLE Excel NumberFormat

    Hi All,
    In OLE for example consider the follwing statement,
    SET PROPERTY OF wf_cell1 'NumberFormat' = '@'.
    How can I get to know the list of possible values for 'NumberFormat' with their meaning?
    (Actually I want to use Currency format in my EXCEL application)
    Regards,
    Manoj Kumar P

    Dear Manoj,
    HOpe this will help you https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/exporting%252bdata%252bto%252bexcel%252b-%252bxml%252bto%252bthe%252brescue
    Regards,
    Pravin s

  • Create an excel file from java

    I am using Jakarta's POI to create an excel file from MySql. The POI works well when a samll amount of data was written from MySql (created .xls file less than 3500KB). The problem is when a large amount of data need to be written to an excel file, java.lang.OutOfMemoryError Exception in thread "main" appears. In my project, I really need to have a large amount of data to be wriiten ton excel file. Do somebody has good solution for it?
    Thanks

    What about using some text files like csv
    (comma-separated value) file? It is plain text but
    Excel (and other spreadsheet programs) will be able to
    read it.
    But then there will be no formatting and bells and
    whistles. It was just an idea.Excel will also read HTML <TABLE>'s, with full formatting. There are some extra tags for numeric formatting, also. Just create an HTML table, and save to a file with .xls extension, e.g.:
    <TABLE>
    <TR bgcolor="#00FF7F">
    <TH>Agency ID</TH>
    <TH>POS ID</TH>
    <TH>Machine Serial</TH>
    <TH>Disk Serial</TH>
    <TH>MAC ID</TH>
    <TH>System Manufacturer</TH>
    <TH>Machine Type</TH>
    <TH>BIOS Manufacturer</TH>
    <TH>BIOS Version</TH>
    <TH>BIOS Date</TH>
    </TR>
    <TR bgcolor="#9ACD32">
    <TD>1000</TD>
    <TD>1069</TD>
    <TD STYLE='vnd.ms-excel.numberformat:@'>US215199248</TD>
    <TD STYLE='vnd.ms-excel.numberformat:@'>5C5AE88F3</TD>
    <TD STYLE='vnd.ms-excel.numberformat:@'>000423155334</TD>
    <TD>Hewlett-Packard</TD>
    <TD>Desktop</TD>
    <TD>American Megatrends Inc.</TD>
    <TD>JA.01.03US</TD>
    <TD>07/19/2001</TD>
    </TR>
    </TABLE>

  • Error in Open Excel Files from JSP..it display Eksponen...

    How to set Excel format in JSP? - Error in Eksponen.
    Hi, i have a problem.
    I am using JSP to select data from database and open it as an Excel file.
    It works perfectly, but the problem is,
    when the data is NUMBER (even though in JSP, i declare it as a String), in the Excel file, when the data is more than 10, the data will change to Eksponen value.
    Should be = 982520000324464
    but in Excel is = 9.8252E+14
    Can anybody help?

    Depending on how you are generating the Excel file there are different solutions.
    If you are generating the Excel file using contentType="application/vnd.ms-excel" and HTML tables, then you can use the following attribute on the cell you wish to format:
    <TD style="vnd.ms-excel.numberformat:#,##0;">24.562234</TD>where the #,##0 corresponds to the format you wish to present the data in.

  • Error n downloding files from  jsp

    Dear all
    hiiiiii
    this my code
    ServletOutputStream outs2 =response.getOutputStream();
    FileInputStream fis = new FileInputStream(file path which i need to download);
    response.setBufferSize((int)f.length());
    int c=-1;
    while ((c= fis.read()) != -1)
    outs2.write(c);
    outs2.flush();
    outs2.close();
    if file is zip file
    the problem when client download file and open it direct without save it ,it give him error that win can not find file
    if i make sendredirect on file it work ok but i nedd to download file out of application on another driver here i cant make sendredirect

    Depending on how you are generating the Excel file there are different solutions.
    If you are generating the Excel file using contentType="application/vnd.ms-excel" and HTML tables, then you can use the following attribute on the cell you wish to format:
    <TD style="vnd.ms-excel.numberformat:#,##0;">24.562234</TD>where the #,##0 corresponds to the format you wish to present the data in.

  • Export Query Data to Excel

    Hey guys, I have a cfm page that I am using to query data, and the  result set is displayed on the same page when a user clicks submit.
    My question is, I would like to create a clickable icon where, after a  user runs the query and the data table displays, I want the user to be  able to click a little Excel icon that will allow them to download the  data in Excel.
    So, a user clicks on a little icon somewhere on the page and IE or  Firefox or whatever pops up a little dialog box asking them if they want  to OPEN or SAVE the file results.xls.  How can I do this?
    Here is my current code, but where do I implement the cfoutput stuff to  export?  On the same page?
    <cfquery name="qActivity" datasource="khamp" result="resultInfo">
         SELECT KHAMELEON.GL_DETAIL.ACCOUNT, KHAMELEON.GL_ACCOUNT.DES1, KHAMELEON.GL_DETAIL.ENTITY,
        SUM (KHAMELEON.GL_DETAIL.AMOUNT) AS "TotalAmt"           
         FROM KHAMELEON.GL_ACCOUNT, KHAMELEON.GL_DETAIL
        WHERE 0=0
        <cfif Form.Entity IS NOT "">
              AND KHAMELEON.GL_DETAIL.ENTITY = '#Form.Entity#'
         </cfif>
        AND KHAMELEON.GL_DETAIL.ACCTG_DATE <= '#Form.asofday#-#Form.asofmonth#-#Form.asofyear#'
        <cfif Form.accountnum IS NOT "">
        AND KHAMELEON.GL_ACCOUNT.ACCOUNT = '#Form.accountnum#'
        </cfif>
        AND KHAMELEON.GL_ACCOUNT.ACCOUNT=KHAMELEON.GL_DETAIL.ACCOUNT
        GROUP BY
    KHAMELEON.GL_ACCOUNT.ACCOUNT,
    KHAMELEON.GL_DETAIL.ACCOUNT,
    KHAMELEON.GL_ACCOUNT.DES1,
    KHAMELEON.GL_DETAIL.ENTITY
         HAVING SUM(KHAMELEON.GL_DETAIL.AMOUNT)<>0
         ORDER BY KHAMELEON.GL_ACCOUNT.ACCOUNT ASC
         </cfquery>
      <cfif resultInfo.Recordcount eq 0>
        No Records Match the Search Criteria.
        <cfelse>
        <hr/>
        <br/>
        <table border="1" class="displaytable">
    <!--Headings Row-->  
            <tr>
               <th>Account</th>
               <th>Description</th>
               <th>Entity</th>
               <th>Book 1</th>
          </tr>
    <!--Result Rows-->   
          <cfoutput query="qActivity">
          <tr>
            <td>#qActivity.ACCOUNT#</td>
            <td>#qActivity.DES1#</td>
            <td>#qActivity.ENTITY#</td>
            <td style="text-align:right">#NumberFormat('#qActivity.TotalAmt#', "_(999,999,999.99)")#</td>
          </tr>
          </cfoutput>
    I got the following code off of a thread in the forum, but it trys to  download the excel file as soon as the query is run (the excel download  doesn't work though, it trys to download the actual cfm page instead):
    <cfheader name="Content-Disposition"
    value="inline; filename=tb.xls">
    <cfcontent type="application/vnd.ms-excel">
    <table border="2">
    <tr>
    <td> Account </td><td> Description </td><td> Entity </td><td> Book1 </td>
    </tr>
    <cfoutput query="qActivity">
    <tr>
    <td>#qActivity.ACCOUNT#</td><td>#qActivity.DES1#</td><td>#qActivity.ENTITY#</td><td>#NumberFormat('#qActivity.TotalAmt#', "_(999,999,999.99)")#</td>
    </tr>
    </cfoutput>
    </table>
    </cfcontent>
    Thanks guysq

    To actually get the data into excel, google "cold fusion excel poi" and look for Ben Nadel's cfc.  Otherwise you might have issues with Office 2007.
    For the icon or whatever, make your query a session variable.  Then have the icon link to either a self closing popup or a very small iframe that exports the query to an excel file and then uses cfcontent to download it to the user.

  • How to  read from excel file and write it using implicit jsp out object

    our code is as below:Please give us proper solution.
    we are reading from Excel file and writing in dynamicaly generated Excel file.it is writing but not as original excel sheet.we are using response.setContentType and response.setHeader for generating pop up for saveing the original file in to dynamically generated Excel file.
    <%@ page contentType="application/vnd.ms-excel" %>
    <%     
         //String dLoadFile = (String)request.getParameter("jspname1");
         String dLoadFile = "c:/purge_trns_nav.xls" ;
         File f = new File(dLoadFile);
         //set the content type(can be excel/word/powerpoint etc..)
         response.setContentType ("application/msexcel");
         //get the file name
         String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
         //set the header and also the Name by which user will be prompted to save
         response.setHeader ("Content-Disposition", "attachment;     filename="+name);
         //OPen an input stream to the file and post the file contents thru the
         //servlet output stream to the client m/c
              FileInputStream in = new FileInputStream(f);
              //ServletOutputStream outs = response.getOutputStream();
              int bit = 10;
              int i = 0;
              try {
                        while (bit >= 0) {
                        bit = in.read();
                        out.write(bit) ;
    } catch (IOException ioe) { ioe.printStackTrace(System.out); }
              out.flush();
    out.close();
    in.close();     
    %>

    If you want to copy files as fast as possible, without processing them (as the DOS "copy" or the Unix "cp" command), you can try the java.nio.channels package.
    import java.nio.*;
    import java.nio.channels.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    class Kopy {
         * @param args [0] = source filename
         *        args [1] = destination filename
        public static void main(String[] args) throws Exception {
            if (args.length != 2) {
                System.err.println ("Syntax: java -cp . Kopy source destination");
                System.exit(1);
            File in = new File(args[0]);
            long fileLength = in.length();
            long t = System.currentTimeMillis();
            FileInputStream fis = new FileInputStream (in);
            FileOutputStream fos = new FileOutputStream (args[1]);
            FileChannel fci = fis.getChannel();
            FileChannel fco = fos.getChannel();
            fco.transferFrom(fci, 0, fileLength);
            fis.close();
            fos.close();
            t = System.currentTimeMillis() - t;
            NumberFormat nf = new DecimalFormat("#,##0.00");
            System.out.print (nf.format(fileLength/1024.0) + "kB copied");
            if (t > 0) {
                System.out.println (" in " + t + "ms: " + nf.format(fileLength / 1.024 / t) + " kB/s");
    }

  • Can you open a report in Excel/Word desktop instead of the web pugin?

    using run_report_object( and web.show_document,
    how or can you get a report to open in the desktop/full version of MS Excel/Word instead of the web plugin versions?
    I can get the browser to open a report in pdf with my desktop adobe reader, but not with an rtf or xml/delimited desformat.
    Currently I don't pass a mimetype when opening as a pdf, but I do pass one in the url when i am destypes of xml, delimited and rtf,
    as this is the only way i have found out how to open the reports in word/excel.
    I'm in the process of upgrading from forms 6 client/server to 10g developer suite, so this is my try with a web based system.
    Does anyone have any suggestions, or where I should look.
    Below I listed my code from a procedure.
    the first part of the procedure is alot of converting, but if you skip down to the part between the 2 sets of double lines this fairly standard.
    PACKAGE BODY pmc_lib IS
    -- Procedure to run the report.
    procedure run_reports(v_report_name in varchar2, -- Report Name with or w/o a path.
    v_commode in number default synchronous, -- commode
    v_execmode in number default runtime, -- execute mode
    v_file_sys in number default filesystem, -- dummy
    v_param_list in paramlist, -- parameter list
    v_show_modes in varchar2 default null) is -- used for testing,
    -- if set to anthing but null, the report properties will display
    -- on the screen through an alert prior to printing.
    v_errorcode number;
    v_errortext varchar2(600);
    v_initialized boolean := false;
    v_prop_reportserver varchar2(200);
    v_report_path varchar2(200);
    v_user varchar2(100);
    v_user_sessionid number;
    v_forms_version varchar2(100);
    v_default_report_server varchar2(200);
    v_default_server_domain_path varchar2(200);
    v_connect_string varchar2(3) := get_application_property(connect_string);
    v_user_name varchar2(35) := get_application_property(username);
    report_id report_object;
    reportserverjob varchar2(100);
    v_jobid varchar2(100);
    rep_status varchar2(100);
    v_url varchar2(500);
    v_url2 varchar2(500);
    v_parameter_value varchar2(100);
    v_destype_param_value varchar2(100) := null;
    v_desformat_param_value varchar2(100) := null;
    v_desname_param_value varchar2(100) := null;
    v_value_n number := 0;
    v_param_type number := text_parameter;
    v_prop_execmode number;
    v_prop_commode number;
    v_prop_destype number;
    v_prop_filename varchar2(200);
    v_prop_source_block varchar2(200) := null;
    v_prop_query_name varchar2(200) := null;
    v_prop_desname varchar2(200) := null;
    v_prop_desformat varchar2(200) := null;
    v_prop_reportserver varchar2(200) := null;
    v_prop_other varchar2(200) := null;
    v_mimetype varchar2(200) := null;
    v_selected_mimetype varchar2(200) := null;
    report_not_generated exception;
    report_id_not_found exception;
    BEGIN
    v_forms_version := get_application_property(version);
    v_prop_reportserver := get_report_object_property('report1', report_server);
    v_report_path := null;
    v_user := v_user_name || '/' ||
    get_application_property(password) || '@' ||
    v_connect_string;
    if v_connect_string = 'NNN' then
    v_default_server_domain_path := 'pmcoracapp01.aapmc.com/reports/rwservlet';
    v_default_report_server := 'rep_pmcoracapp01_frhome1';
    else
    v_default_server_domain_path := 'oradevsrv.aapmc.com/reports/rwservlet';
    v_default_report_server := 'rep_oradevsrv_frhome1';
    end if;
    v_initialized := true;
    -- Check to see what version of forms is running.
    if substr(v_forms_version, 1, 1) <> '6' then
    -- Check to see if WEB version is running
    -- This may be an unnecessary check.
    if (get_application_property(user_interface) = 'WEB') then
    report_id := find_report_object('report1');
    -- id_null won't work on a report_id in Version 6, may put back in 10g once version 6 is gone completly
    -- if id_null(report_id) then
    -- raise report_id_not_found;
    -- end if;
    -- Because of Convertions from old system the following are needed.
    -- 1) If 'execmode' is runtime, then change it to batch.
    if v_execmode = runtime then
         v_prop_execmode := batch;
    else
         v_prop_execmode := v_execmode;
    end if;
    -- 2) If Report name has an attached path, then remove it.
    v_value_n := instr(lower(v_report_name), 'k:\pmc\new\');
    if v_value_n = 0 then
         v_prop_filename := v_report_name;
    else
         v_prop_filename := substr(v_report_name, v_value_n + 11);
    end if;
    -- From looking at the FORMS, 'destype' parameter is always passed in from the FORM.
    -- It is either 'preview' or 'file'.
    -- This is here for the converstion from Forms 6 to 10g.
    -- If for some reason destype has not been passed in as a parameter, you will get a FORM error,
    -- saying the parameter does not exists.
    begin
    -- 3) If 'destype' is one of the following, then change it to cache.
    get_parameter_attr(v_param_list, 'destype', v_param_type, v_destype_param_value);
    if lower(nvl(v_destype_param_value, 'null')) in ('preview', 'file', 'null') then
    v_prop_destype := cache;
    -- 3a) If 'destype' was = 'file' then check the 'desformat' and 'desname'.
    if lower(nvl(v_destype_param_value, 'null')) = 'file' then
    -- 3b) Get 'desformat' value
    get_parameter_attr(v_param_list, 'desformat', v_param_type, v_desformat_param_value);
    -- 'delimited' was not working, so change all 'delimited' to 'delimiteddata'.
    if lower(nvl(v_desformat_param_value, 'null')) = 'delimited' then
         v_desformat_param_value := 'delimiteddata';
    end if;
    -- 3c) If 'desformat' is NOT one of the following, then change it to pdf.
    if lower(nvl(v_desformat_param_value, 'null')) not in ('pdf', 'xml', 'rtf', 'delimiteddata') then
    v_prop_desformat := 'pdf';
    else
    v_prop_desformat := lower(v_desformat_param_value);
    end if;
    -- 4) Get 'desname' property.
    get_parameter_attr(v_param_list, 'desname', v_param_type, v_desname_param_value);
    v_prop_desname := lower(v_desname_param_value);
    end if;
    else
    v_prop_destype := lower(v_destype_param_value);
    end if;
    exception
    when others then
    null;
    end;
    -- If a desformat is rtf, xml, or delimited then get a mimetype to pass to the url
    if lower(v_prop_desformat) = 'rtf' then
    v_mimetype := '&mimetype=application/msword';
    elsif lower(v_prop_desformat) = 'xml' then
    v_mimetype := '&mimetype=application/vnd.ms-excel';
    elsif lower(v_prop_desformat) = 'delimiteddata' then
    v_mimetype := '&mimetype=application/vnd.ms-excel';
    end if;
    -- 6) If the Following are not set within the Report Object then
    -- set them to the following defaults.
    -- These are al required to be set for the Report Object to Function.
    -- These are the defaults for AAPMC.
    v_prop_execmode := nvl(v_prop_execmode, batch);
    v_prop_commode := nvl(v_prop_commode, synchronous);
    v_prop_destype := nvl(v_prop_destype, cache);
    v_prop_desformat := nvl(v_prop_desformat, 'pdf');
    v_prop_reportserver := nvl(v_prop_reportserver, v_default_report_server);
    -- Set All Report_Object Properties
    set_report_object_property(report_id, report_execution_mode, v_prop_execmode);
    set_report_object_property(report_id, report_comm_mode, v_commode);
    set_report_object_property(report_id, report_destype, v_prop_destype);
    set_report_object_property(report_id, report_filename, v_prop_filename);
    set_report_object_property(report_id, report_source_block, v_prop_source_block);
    set_report_object_property(report_id, report_query_name, v_prop_query_name);
    set_report_object_property(report_id, report_desname, v_prop_desname);
    set_report_object_property(report_id, report_desformat, v_prop_desformat);
    set_report_object_property(report_id, report_server, v_prop_reportserver);
    set_report_object_property(report_id, report_other, v_prop_other);
    -- Run Report_Object
    reportserverjob := run_report_object(report_id, v_param_list);
    v_jobid := substr(reportserverjob, length(v_prop_reportserver) + 2, length(reportserverjob));
    -- If Report Status is not 'FINISHED', then loop till it is.
    if reportserverjob is not null then
    rep_status := report_object_status(reportserverjob);
    while rep_status in ('RUNNING', 'OPENING_REPORT', 'ENQUEUED') loop
    rep_status := report_object_status(reportserverjob);
    end loop;
    if rep_status <> 'FINISHED' then
    raise report_not_generated;
    end if;
    -- Create 1st part of url.
    v_url := 'http://' || v_default_server_domain_path || '/getjobid' || v_jobid || '?server=' || v_prop_reportserver;
    -- Check for mimetype.
    if v_mimetype is not null then
    v_url := v_url || v_mimetype;
    end if;
    -- Final part of url.
    v_url2 := 'javascript:window.open("' || v_url || '", "", "fullscreen=no, titlebar=no, location=no, toolbar=no, menubar=no, status=no, resizable=yes"); self.close()';
    -- This is the built-in that calls a new browser window
    web.show_document(v_url2,'_blank');
    else
    raise report_not_generated;
    end if;
    end if;
    -- Destroy the parameter list.
    destroy_parameter_list(v_param_list);
    else
    -- This section if for Client Server, Version 6 of forms.
    -- It will do the same as before the conversion.
    -- It is only used before the complete conversion.
    if v_report_name is null then
    return;
    end if;
    v_value_n := instr(v_report_name, 'k:\pmc\new\');
    if v_value_n = 0 then
         v_prop_filename := 'k:\pmc\new\' || v_report_name;
    else
    v_prop_filename := v_report_name;
    end if;
    run_product(reports,
    v_prop_filename,
    v_commode,
    v_execmode,
    filesystem,
    v_param_list,
    null);
    end if;      
    -- create history record of the report being run
    insert into pmc_report_history values(
    s_pmc_report_history.nextval,
    v_prop_filename,
    v_user_name,
    sysdate,
    v_forms_version,
    v_jobid,
    v_destype_param_value,
    v_desformat_param_value,
    v_desname_param_value,
    v_prop_destype,
    v_prop_desformat,
    v_prop_desname,
    v_mimetype,
    v_window_open_params);
    commit;
    exception
    when report_id_not_found then
    show_user_alert('ERROR: Cannot Find Report Object!', null);
    when report_not_generated then
    show_user_alert('ERROR: Report Not Generated!', null);
    when others then
    v_errorcode := SQLCODE;
    v_errortext := SQLERRM;
    show_user_alert('ERROR : ' || v_errorcode || ' = ' || v_errortext, null);
    end;
    end;

    What you could try is downloading the report to the client pc using WEBUTIL_FILETRANSFER.URL_TO_CLIENT, then open the locally save file using something like:
    CLIENT_HOST('cmd /c rundll32.exe url.dll,FileProtocolHandler "localfilename"');

  • Exporting a MySQL table to Excel

    My users have asked for the ability to download a MySQL table to an Excel spreadsheet. Being an amateur at all this PHP stuff I googled around and found a script that is supposed to do this. It's failing with "Couldn't select database: Access denied for user 'holli10_tonybabb'@'%' to database '_admin' 1044"
    It seems to be picking up an extra "@%" from somewhere
    I used the same settings that I successfully used for a CRON backup job.. I'd really appreciate any insight you can suggest. The script is shown below,
    Thanks
    Tony
    <?php
    //EDIT YOUR MySQL Connection Info:
    $DB_Server = "209.200.244.80";  //your MySQL Server
    $DB_Username = "holli10_tonybabb";     //your MySQL User Name
    $DB_Password = "abcd1234";    //your MySQL Password
    $DB_DBName = "_admin";    //your MySQL Database Name
    $DB_TBLName = "volunteers";    //your MySQL Table Name
    //$DB_TBLName,  $DB_DBName, may also be commented out & passed to the browser
    //as parameters in a query string, so that this code may be easily reused for
    //any MySQL table or any MySQL database on your server
    //DEFINE SQL QUERY:
    //you can use just about ANY kind of select statement you want -
    //edit this to suit your needs!
    $sql = "Select * from $DB_TBLName";
    //Optional: print out title to top of Excel or Word file with Timestamp
    //for when file was generated:
    //set $Use_Titel = 1 to generate title, 0 not to use title
    $Use_Title = 1;
    //define date for title: EDIT this to create the time-format you need
    $now_date = date('m-d-Y H:i');
    //define title for .doc or .xls file: EDIT this if you want
    $title = "Dump For Table $DB_TBLName from Database $DB_DBName on $now_date";
    Leave the connection info below as it is:
    just edit the above.
    (Editing of code past this point recommended only for advanced users.)
    //create MySQL connection
    $Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password)
    or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno());
    //select database
    $Db = @mysql_select_db($DB_DBName, $Connect)
    or die("Couldn't select database:<br>" . mysql_error(). "<br>" . mysql_errno());
    //execute query
    $result = @mysql_query($sql,$Connect)
    or die("Couldn't execute query:<br>" . mysql_error(). "<br>" . mysql_errno());
    //if this parameter is included ($w=1), file returned will be in word format ('.doc')
    //if parameter is not included, file returned will be in excel format ('.xls')
    if (isset($w) && ($w==1))
    $file_type = "msword";
    $file_ending = "doc";
    }else {
    $file_type = "vnd.ms-excel";
    $file_ending = "xls";
    //header info for browser: determines file type ('.doc' or '.xls')
    header("Content-Type: application/$file_type");
    header("Content-Disposition: attachment; filename=database_dump.$file_ending");
    header("Pragma: no-cache");
    header("Expires: 0");
    /* Start of Formatting for Word or Excel */
    if (isset($w) && ($w==1)) //check for $w again
    /* FORMATTING FOR WORD DOCUMENTS ('.doc')   */
    //create title with timestamp:
    if ($Use_Title == 1)
      echo("$title\n\n");
    //define separator (defines columns in excel & tabs in word)
    $sep = "\n"; //new line character
    while($row = mysql_fetch_row($result))
      //set_time_limit(60); // HaRa
      $schema_insert = "";
      for($j=0; $j<mysql_num_fields($result);$j++)
      //define field names
      $field_name = mysql_field_name($result,$j);
      //will show name of fields
      $schema_insert .= "$field_name:\t";
       if(!isset($row[$j])) {
        $schema_insert .= "NULL".$sep;
       elseif ($row[$j] != "") {
        $schema_insert .= "$row[$j]".$sep;
       else {
        $schema_insert .= "".$sep;
      $schema_insert = str_replace($sep."$", "", $schema_insert);
      $schema_insert .= "\t";
      print(trim($schema_insert));
      //end of each mysql row
      //creates line to separate data from each MySQL table row
      print "\n----------------------------------------------------\n";
    }else{
    /* FORMATTING FOR EXCEL DOCUMENTS ('.xls')   */
    //create title with timestamp:
    if ($Use_Title == 1)
      echo("$title\n");
    //define separator (defines columns in excel & tabs in word)
    $sep = "\t"; //tabbed character
    //start of printing column names as names of MySQL fields
    for ($i = 0; $i < mysql_num_fields($result); $i++)
      echo mysql_field_name($result,$i) . "\t";
    print("\n");
    //end of printing column names
    //start while loop to get data
    while($row = mysql_fetch_row($result))
      //set_time_limit(60); // HaRa
      $schema_insert = "";
      for($j=0; $j<mysql_num_fields($result);$j++)
       if(!isset($row[$j]))
        $schema_insert .= "NULL".$sep;
       elseif ($row[$j] != "")
        $schema_insert .= "$row[$j]".$sep;
       else
        $schema_insert .= "".$sep;
      $schema_insert = str_replace($sep."$", "", $schema_insert);
      //following fix suggested by Josue (thanks, Josue!)
      //this corrects output in excel when table fields contain \n or \r
      //these two characters are now replaced with a space
      $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert);
      $schema_insert .= "\t";
      print(trim($schema_insert));
      print "\n";
    ?>
    <?php /*_____________________END___OF___THE___CODE______________________
    get more code from http://www.fundisom.com/phparadise/
    ___________________________________________________________________*/ ?>

    Never mind. The web hosting support people people told me I had my parameters wrong. It works fine now.

Maybe you are looking for