ExportCollectionActionListener dropping leading zeroes

We use <af:exportCollectionActionListener> tag to provide users with the ability to export data from some <af:table>s to MS Excel. We have problems with data values like "01.21", for example, which are converted by Excel to "January, 21". Also when there are numeric codes with leading zeros, these zeros are stripped because Excel recognizes the values as numbers. Does anybody know if it is possible to solve this problem easily (for example by specifying somehow the data format of particular columns in Excel export as "Text")?
I did some research on the web and found a creative solution for surrounding the value with some characters in a way that is visible only on the Excel file and not in the HTML page. It looks something like this:
<af:column sortProperty="Header" sortable="true"
headerText="#{bindings.MyReport.hints.MyData.label}"
id="resId1c27">
<af:panelGroupLayout layout="horizontal" id="panel999">
<af:outputText value="=TEXT(&quot;" inlineStyle="display:none" id="ot1444"/>
<af:outputText value="#{row.MyData}" id="ot21"/>
<af:outputText value="&quot;,&quot;0&quot;)" inlineStyle="display:none" id="ot222999"/>
</af:panelGroupLayout>
</af:column>
The idea is that in the Excel we end up with an output like this:
=TEXT("MyValue", "0")
The problem is that I'm seeing that output verbatim so it looks like Excel is not recognizing it properly.
Any ideas on how to tell Excel the data type for a particular column?
BTW, I'm coding on Jdev 11.1.3.
Thanks,
MV

Hi,
actually the formatting work around was based on a bug, which got fixed in JDeveloper. So right now we don't have an option to provide Excel formatting
Frank

Similar Messages

  • Excel copy drops leading zeros

    I have records with a part number that is a text field, but contains digits. When I export to excel, the excel spreadsheet drops leading zeros from the part number.
    How do I get the export to treat this as a text field and retain the zeros.
    No, I have no option to make this a number field.

    When the report is displayed on the screen initially for column "blah" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') = 0" evaluates to TRUE because REQUEST does not have 'EXCEL' in it causing the value to display on the screen. For column "blah_excel" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') != 0" evaluates to FALSE because REQUEST does not have 'EXCEL' in it causing "blah_excel" to not display.
    When the user clicks to download to CSV the page's REQUEST has 'EXCEL' in it. I think actual request value is 'FLOW_EXCEL'. For column "blah" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') = 0" evaluates to FALSE because REQUEST has 'EXCEL' in it causing the value to not appear in the CSV. For column "blah_excel" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') != 0" evaluates to TRUE because REQUEST does have 'EXCEL' in it causing "blah_excel" to appear in the CSV.
    http://mikerife.blogspot.com/2007/08/preserve-leading-zeros-in-apex-csv.html
    Mike

  • Export to Excel dropping leading zeroes

    Hi,
    I have used the 'Export' feature of the form and is working well except it drops the leading zeroes on some columns.
    I have defined them as string so it should retain them. How can I keep the zeroes?
    Thank you.

    When you say that is dropping the zeros only for a few columns, is it working fine for other columns having leading zeros? If yes, check the type of data defined for the placeholder bean and the data type of the corresponding VO column.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL SELECT DROPPING LEADING ZEROS

    Has anyone run accross the problem of Oracle 10g dropping the leading zeros on a Varchar field when you select the value?? Do you know the fix?

    SQL> desc pa_Students;
    Name Null? Type
    ID NOT NULL NUMBER(22)
    SQL> select distinct id from pa_students;
    ID
    2841
    2843
    2846
    2861
    2867
    2873
    2890
    2892
    2903
    9 rows selected.
    SQL> select distinct to_char(id,'000000000') from pa_students;
    TO_CHAR(ID,'000000000')
    000002841
    000002843
    000002846
    000002861
    000002867
    000002873
    000002890
    000002892
    000002903
    9 rows selected.
    SQL> select distinct lpad(id,9,'0') from pa_students;
    LPAD(ID,9,'0')
    000002841
    000002843
    000002846
    000002861
    000002867
    000002873
    000002890
    000002892
    000002903
    9 rows selected.
    The problem is that I need to first have the leading zeros. I also need to select multiple fields, but
    because of all of the extra spaces to the right of the data, everything I pick gets wrapped around. This
    never happened until we moved to an Oracle 10g database.

  • IR - Column with leading Zeros issue

    Hello,
    I've got an IR report which includes as "default report settings" 1 column with leading 0s. In order to export to Excel that column as text rather than as a numeric I followed a workaround proposed before in this forum (excel copy drops leading zeros
    In essence this workaround is to create an identifical column but in "excel text format" and display the columns depending on the request value: INSTR(NVL(:REQUEST,'YABBADABBADO'),'CSV') <> 0 for example.
    This works just fine for the default report.
    The problem arise when a user creates his own customise report that includes the mentioned column and saves it as a named report. Here, when the results are exported to excel the "excel" column does not appear.
    In fact, just hiding one of the displayed columns produces the same undesired result.
    I would appreciate any comments or suggestions.
    Many thanks
    Edited by: Javier Gil on Jul 20, 2010 7:52 AM

    I have found a better method. In your IR query:
    SELECT LPAD(v.vendor, 7, ' ') vendor,
    /*Just LPAD to a length of the column defined in the database table or to 7, whichever is greater. */
    FROM v, r
    WHERE v.VENDOR = r.VENDOR
    AND date_rcv <= to_date(:P150_CUTOFF,'yyyy/mm/dd')
    AND inv_nbr = ' '
    AND to_stores <> 'T'
    AND (V.VENDOR = RPAD(:P150_VENDOR,10,' ') OR :P150_VENDOR = 'ALL')
    When you download to Excel by Download/XLS (Request=XLS), it preserves the leading zeros.
    In the case of dates, you should LPAD 10 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YY'), 10, ' ') date_rcv,
    I haven’t tried it yet but I think in the case of ‘MM/DD/YYYY’, you should LPAD 12 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YYYY'), 12, ' ') date_rcv,
    Drawbacks of this method:
    Since the string has leading white spaces, you cannot use the filter for the ‘=’ comparison operator. Even filtering using leading white spaces will not return anything. You must use the LIKE and NOT LIKE operator instead.
    Advantages of this method over the original one I posted yesterday:
    1)     You do not have to create another column for download, just one column will suffice.
    2)     Even though the query has leading white spaces, they will not display in the IR region.
    Edited by: richardlee on Aug 5, 2010 11:10 AM
    Edited by: richardlee on Aug 5, 2010 11:16 AM

  • Leading zero to customer invoice number

    We want to have rules that are payor specific to identify those payors that make changes to our current Invoice numbers.(many customers add leading zero)
    T
    •     Ability to have business rules to allow for consistent anomalies (i.e. payer always drops leading zero)
    How can we do this in AR
    points will be surely awarded.
    Thanks
    Nik

    When you load the files if you right justify the zeroes shouldn't matter.
    pls assign pts to say thanks.

  • Export to Excel - data with leading zeros

    Does anyone have any tips or tricks for running a query then exporting to Excel without dropping leading zeros from the data?
    Examples: numeric Item codes with leading zeros, telephone numbers that have been entered with no spaces.
    Regards,
    Douglas McDove

    < Font Color="RED" Size = 3 Face=Verdana>
    I liked the challenge and therefore.......I got this for you
    </Font>
    SELECT CHAR(28) + T0.CardCode [BP Code\] FROM  [dbo\].[OCRD\] T0
    SELECT CHAR(29) + T0.CardCode [BP Code\] FROM  [dbo\].[OCRD\] T0
    SELECT CHAR(30) + T0.CardCode [BP Code\] FROM  [dbo\].[OCRD\] T0
    SELECT CHAR(31) + T0.CardCode [BP Code\] FROM  [dbo\].[OCRD\] T0
    Any of the above 4 should work.  T0.CardCode is the database field I tested, you can substitute this with any database field and it should work.
    Regards
    Suda

  • Leading zeroes dropped in Excel

    Hello folks
    I've got an issue with using downloading data onto an Excel file using the FM GUI_Download. The leading zeroes of the PERNR field get truncated when opening the file with MS Excel.
    However the zeroes are in place when the downloaded file is opened with notepad or any other text editor.
    Is there any solution to prevent Excel from dropping the leading zeroes.
    I'm currently using tab as the field separator, and have defined the PERNR field as TYPE C at the internal table used for populating and displaying the data.

    Hi,
    data:matnr(20) type c.
    concatenate text-001 g_t_ekpo-matnr into g_t_ekpo-matnr.
    text-001 is having '.
    I had declared the Matnr as type c so that it can accomodate that single quote.It is indeed downloading the matnr with preceeding zeroes into the excel but along with the single quote.Can't we get the preceeding zeroes into excel without the single quote into the excel.
    Thanks,
    Kiran.

  • Leading zeros are dropped when exporting as csv

    I have a report that when I export as csv, leading zeros in text columns are dropped in excel. The text columns appear fine in the report, however, when I export the leading zero is gone in excel. For example, in the report my text column could have a value of 0101, when it is exported to excel it has a value of 101. The code behind the link to export to csv is f?p=&APP_ID.:&APP_PAGE_ID.:&SESSION.:FLOW_EXCEL_OUTPUT_R#REGION_ID#
    Is there a way to keep the leading zero in excel?
    Regards
    Mark

    Thanks for your reply. In my query I wrapped the column with double quotes as you suggest, and added the same column for display:
    select '"'||column1||'"' execl_col, column1 disp_col from table where ....
    Using htmldb_application.g_excel_format as a conditional display I can control what is displayed on the screen and export to csv the double quoted text field. I have that part working fine. Using my previous data example, I am now seeing in excel 0101"".
    Did I wrap the field incorrectly with double quotes? How can I exclude the
    double quotes in the export to csv?
    Regards
    Mark

  • FQP6A - Leading zeros dropped

    Hi all,
    I need to create a cheque lot using FQP6A, however, the leading zeros are dropped. eg: 0123456, changed to 12345.
    Is this standard? Or is there missing configuration.
    Please advise.

    Hello,
    It is the standard functionlaity of the system that  Leading zeros are not displayed.
    You could review note  10714 for more info....
    Hope this helps.
    Regards
    Olivia

  • Remove Leading zeros for Material in Transformation

    Hi Experts,
    I'm using DTP first time. I don't have much exp on DTP & Transformations.
    I'm creating infocube with some objects. I want to remove leading zeros for zmaterial.
    In 3.x writen update routines as fallows:
    data: zmat(18) type c.
    zmat = COMM_STRUCTURE-/BIC/ZMAT.
    shift zmat left deleting leading '0'.
    result value of the routine
      RESULT = zmat.
    I'm confusing in Transfermation where to write this routines.
    I'm writing in Transformation as fallows:
    data: zmat(18) type c.
    zmat = SOURCE_FIELDS-/BIC/ZMAT.
    shift zmat left deleting leading '0'.
    RESULT = zmat.
    But it's getting remove zero's.
    Anybody suggest on this.
    Siri

    Dear Sir,
    No confusion at all.
    Just double click on the Target Infoobjct i,e Material object in Transformation, you will see a wizard popping up.
    There you will see a option called "RULE TYPE" and the default value will be "Direct Assignment". In the same check box click on the drop down icon and select "Routine".
    The moment you select the routine option, it will open up ABAP workspace where in you can write your routine and get the desired result.
    Hope it helps.

  • Need formula to take text from one cell, add that to a serial number with leading zeros

    I'm trying to create a spreasdheet cell that simplifies creating videotape Numbers from a job name in cell and appends a serial number with leading zeros, and that would survive an export to EXCEL.
    The result would look like
     A Column
    Job Name
    B ColumnTape #
    Formula needed for B
    ClientName-TapeType-
    ClientName-TapeType-001
    =
    ClientName-TapeType-
    ClientName-TapeType-002
    =
    I've tried using a custom cell format that had the text in front of the (Integer) drag and drop, with three integers and leading zeros.
    That worked, but requires recreating the custom cell format for each client and tape type.
    So, I've used the formula =A2& in order to play around with different things, but haven't hit on something that adjusts for increased numbers and retains the leading zeros.
    I don't mind doing a starter for the first row and then adding +1 in the formulas for the rows below.
    I've done that using the custom cell formats for the first B cell and then using =Bx+1 in the following cells.  It works, but I'm hoping to find something simpler or that can be copied and pasted in multiple rows on one paste.
    Thanks in advance.
    Suggestions much appreciated!
    Ted

    Ted,
    This expression in B will give you the pattern I believe you are looking for:
    =A&RIGHT("00"&ROW()-1, 3)
    Here's a screen shot...
    Jerry

  • 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!

  • Keeping leading zero intact  in mail attachment

    Hi All,
    I am sending the excel document into recipients mail id but the leading zero's in the data get truncated.
    I have read so many posts in the forum but did not find any answer to get this done. Some trails i did as follow:
    1. Adding  apostrophes ( ' )  doesn't satisfy my requirement.
    2. Data is good before passing it to mailing function module.
    3. All function module i have tried like SO_NEW_DOCUMENT_ATT_SEND_API1, SO_DOCUMENT_SEND_API1 etc.
       None of them satisfy my requirement.
    Can someone tell  the exact solution?
    Thanks in advance.
    Rudhir Bhaskar

    That's not an SAP email issue though.  I'm sure you'll find that if you open the sent file from a text editor, either from the email client directly or after saving it, that the leading 0's are intact.  Excel is simply interpreting the field as a numeric field upon opening and dropping them.  You need to run the text import wizard and specify the fields as text in order to keep them.

  • Keeping leading zeroes in flat file

    I am loading data from a flat file to a DSO.
    One of the columns in the flat file is data type CHAR with a length of two. The data values will be either 01, 02 or 03.
    When I load the data, the leading zeroes are dropped. Thus, I see 1, 2 and 3 in my DSO. How can I prevent this happening?

    Hi,
    Right Click on that column in Excel file and Formate Cells >Custome> Under Type give "00" and then give the values in column like 01 , 02 .... and save as .csv and close it, immediatly load it, DON"T OPEN FILE, because , if you open it will reset to 1, 2... SO again you need to Right click.....and formare cells..
    Thanks
    Reddy
    Edited by: Surendra Reddy on Jun 24, 2010 4:28 PM

Maybe you are looking for

  • Is it possible to use multiple hard drives with iphoto?

    I am pretty new to Mac's so bear with me, I used to use multiple hard drives on my pc with my photos seperated by catagory in different hard drives. Is it possible to run iphoto with multiple hard drives without the photos loading onto my Imac? If so

  • Flash Lite 2.1 install on Nokia E50

    Just did a Flash Lite 2.1 install on Nokia E50 after I downloaded flashlite2_1_symbian_s60V3 and it installed apparently fine with Nokia installer. However any .swf with test content published to Device Central gets a corrupted file message after I t

  • Zen Micro w/ firmware 1.x and Media Player 10. Get sync

    Hi?I've discovered what was my PC USB 2.0 problems!!! The voltage on mother boart too high! (2.72 instead of the lowest 2.6)!!! That caused USB 2.0 bridge don't working !!! Anyway. Started with the ZM right connected to the front USB 2.0 port I've st

  • InDesign CS3 AD Question

    I have designed an AD in InDesign CS3.  After I have exported it into a PDF, and Take a look at it, it looks good.  However when I print it out there light boxes around the graphics, and sometimes the layers there are not there when I look at it on t

  • Segment

    Dear Experts, Can you put some light,why in the report of FAGLB03,segment coloumn is showing DUMMY, if different profit centres are entered in respective line items with TCODE,F-48 and when same profit centre is repeated with every line item,then cor