+ Start a Discussion

how to dowload file as the TabEliminated format , of Export functionality in salesforce...!

 i had wrote the code but it is not getting download in the tab elimated format..  in need to change the format in controller side or client side.
public class test3 {

public list<CustomerWrapper> lstcustomerwrapper{get;set;}

public test3(){

lstcustomerwrapper = new list<CustomerWrapper>();
public PageReference Exportfileastextformat(){

string  Samplejsonformat = '{"$id":"1","data":[{"applicantname":"Raju","LoanAmount":"350000","address":null,"city":null,"state":"  "},{"applicantname":"Ramesh","LoanAmount":"9600000","address":"E-city banglore","city":"bng","state":"TG"},{"applicantname":"Raghu","LoanAmount":"5690000","address":"mountroad che","city":"che","state":"tn"}]}';

  Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(Samplejsonformat );
  system.debug('mapped and deserialized data is::'+maptest);
       Object ob = (Object)maptest.get('data');    
       system.debug('get data is::'+ob);
      String srlze  = System.JSON.serialize(ob); 
      system.debug('again deserailized is ::'+srlze );
     system.debug('deserilize using the wrapperclass::::::'+lstcustomerwrapper[0].applicantname);
      system.debug('deserilize using the wrapperclass::::::'+lstcustomerwrapper[0].LoanAmount);
PageReference pg = new pageReference('/apex/test4');
 return pg;

 public class CustomerWrapper{
  public string applicantname{get;set;}
  public string LoanAmount{get;set;}
  public string address{get;set;}
  public string city{get;set;}
   public string state{get;set;}

v.f page:1
<apex:page controller="test3">
  <apex:form >
      <apex:commandButton Value="ExportasTextfile" action="{!Exportfileastextformat}"/>

v.f page:test4
<apex:page controller="test3" contentType="text/plain/#test.txt" > <!--contentType="text/plain/#test.txt"--->

 <apex:repeat value="{!lstcustomerwrapper}"  var="a">
 {!a.applicantname} {!a.LoanAmount} {!a.address} {!a.city} {!a.state}

i need to get in the format: need to add the next line when the recrd is compled looped.

Raju   350000
Ramesh  9600000  E-city banglore bng  TG
Raghu     5690000  mountroad che  che  tn

But getting the format is : without breaking and without tabElimination.

Raju   350000 Ramesh  9600000  E-city banglore bng  TG Raghu     5690000  mountroad che  che  tn

note: iam not getting the TabEliminated Functionality...! any useful links..!