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
DeepikareddyDeepikareddy 

How to print Values in next row , while downloading as a Textfile

File is getting dowload..!
1)Need to print the records in the Row by Row..as ALL RECOREDS  is printing in a single row..
 
public class TesttabEliminated{

public list<account> lstaccount{get;set;}
public TesttabEliminated(){

 lstaccount = new list<account>();
 lstaccount =[select id, name from account limit 5];
 
} 
 
}
V.F:
<apex:page controller="TesttabEliminated"   contentType="text/plain/#test.txt">
   <apex:repeat value="{!lstaccount}"  var="a">
 {!a.id}    {!a.name}
 </apex:repeat>
  
</apex:page>

ANY SUGGESTIONS TO PRINT IN THE NEXT ROW WITH THE TABELIMINATED FORMAT.. 

THANKS,
dEEPIKA

 
Ashish Singh SFDCAshish Singh SFDC
Hi Deepika,

Use contentType="application/vnd.ms-excel#AllContacts.xls" and use PageBlocktable to get organized data.

I'm just posting a sample code you can try:

VF:
<apex:page controller="Content_Example"    contentType="application/vnd.ms-excel#AllContacts.xls" >
    <apex:pageblock>
  		<apex:pageBlockTable value="{!lstaccount}" var="a">
        	<apex:column value="{!a.Id}"/>
            <apex:column value="{!a.name}"/>
        </apex:pageBlockTable>
    </apex:pageblock>    
</apex:page>

Controller:
public class Content_Example {
    public list<account> lstaccount {get;set;}
        public Content_Example(){
            lstaccount = [select id, name from account limit 5];
            }
}

Thanks,
Ashish Singh.