You need to sign in to do that
Don't have an account?
URVASHI
Write to CSV file
Hello,
I Wanna write data to the CSV file, and i have the values of those variables in my controller.
How do i di it.
<apex:page controller="comm" cache="true" contentType="text/csv#File.csv" language="en-US"> </apex:page>
I know the above method to create a file as File.csv.
But how do i write data to CSV.
Thanks.
Then its very simple..just access it with the name you provide in the var attribute of <apex:repeat> tag.
All Answers
use list acc in the VF page.
Just include comma separated values in the viualforce page and try to render it.
Avoid including divs,spans or any other HTML/VF components.
Please hit Kudos and mark it as Solution if it helps you.
This is my code for controller.
I wana write inputvalues array in csv file.
so how do i do this?
and i want my code for writing to CSV file in catch block?
Thanks for the reply Neeraj and Asit9.
You can simply use inputvalues array with <apex:repeat> and access its elements.
If its a array of SObject then you can write values like:
Please hit Kudos and mark it as solution if it helps you.
what is value1 ,value2,value3
where do i define them?
Thanks for the help neeraj.
Hi URVASHI,
That was just an example for writing field values of an sObject.
I am assuming that the inputvalues is an array of sObject and value1, value2, value3...valueN are the fields of the sObject.
no my inputvalues is a List of type String.
in this case how do i refer its values in 'outputtext'.
Thanks.
Then its very simple..just access it with the name you provide in the var attribute of <apex:repeat> tag.
Hey thanks neeraj.
I need one more help.
Now all the data is displayed on one single column in excel file.
How do i seperate the data in different columns.
Could you please help me on this.
And if i apply <br/> tag its displayed on excel file.how to avoid doing this?
Thanks.