function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
padmini sspadmini ss 

Generating To CSV file

Hi This is my Vf page :
<apex:page showHeader="false" Sidebar="FALSE"  standardController="Order" cache="true" 
     extensions="SalesOrderReportGenerator"  action="{!SalesOrderReportData}"   contentType="Charset=UTF-8;text/octet-stream#Account.csv;">

<apex:dataTable  value="{!sapRecordListFinal }" var="w" width="1" border="1">  

<apex:column headerValue="SFDC SO No" >
<apex:outputText value="{!w.orderRecord.OrderNumber}"/>
</apex:column>



  

<apex:column headerValue="Order Type" >
<apex:outputText value="{!w.orderRecord.Type}"/>
</apex:column>

<apex:column headerValue="Sales Org " >
<apex:outputText value="{!w.orderRecord.Sales_Org__c}"/>
</apex:column>
</apex:datatable>
There are so many columns , i just showed only few columns.
While eporting to .CSV file am getting this output.
User-added image
Actual Problem is I exported as
contentType="application/csv#RenderAsTestFile.xls"

This is working fine, but our clint have problem with date fileds...like
Date format should be DD/MM/YYYY. But after extraction it is showing as single digit. for example if the date is 7/1/2015 the format should be 07/01/2015(The desired output should be like this). 

Also i want to know where i am doing the mistake , please help me, in this .CSCV file foramt, cuz i want to show the client in CSV format also 

thanks


 

MithunPMithunP
Hi Padmini,

Update your date field code like below.
<apex:outputText value="{0,date,dd'/'MM'/'yyyy}">
    <apex:param value="{!contact.Birthdate}" /> 
</apex:outputText>
Link for full documentation http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_outputText.htm

Mark this as Best Answer, if it solves your problem.

Best Regards,
Mithun.
padmini sspadmini ss
yeah Thank u MithunP, I already made it in vf page i can able to see the format dd/mm/yyyy format 
but after eporting to .xls file it is chaging to d/m/yyyy like 7/9/2014
in excle sheet i want automatically with out modifing the excel sheet U.K date format dd/mm/yyyy format ,
hope you understood my problem
MithunPMithunP
Hi Padmini,

Have you tried to change "escape" and "lang" attributes in outputtext component.

Best Regards,
Mithun.
padmini sspadmini ss
pls tell me i didnt tired, lang attributes pls
MithunPMithunP
Hi Padmini,

Try below samples.
 
<apex:outputText escape="false" lang="en-US" value="test"></apex:outputText>
(OR)
 
<apex:outputText escape="true" lang="en-US" value="test"></apex:outputText>

Best Regards,
Mithun.
padmini sspadmini ss

when i use lang in .csv file it is showing as <div span.....\> something like this,
any how we mailed to clint that to change the excle sheet date format  Uk dd/mm/yyyy fomrat. only
thanks for shairing your knowledge MithunP, thankyou very much.