Hi Deepak,
With no other answers posted, I’m afraid this may be the best that you’re able to achieve.
There doesn’t seem to be a clean way of doing this. I think the best way, is to use Apex, but, after experimenting there may be one extremely hacky way to achieve this. Based on your example of n at the beginning of the line forcing newLines, but also outputting the literal value, I tried a couple of things. First, at the beginning will force a newline, but also include a space in the first column, I couldn’t find a way around this, so I just added a rowCount column, to force this newline.
<apex:page readOnly=”true”
contentType=”application/octet-stream#MyCsv.csv”
sidebar=”false”
standardStylesheets=”false”
showHeader=”false”
cache=”true”
expires=”0″>
<apex:variable value=”{!1}” var=”rowNum”/>
<apex:outputText value=”Row,Column 1,Column 2,Column 3″/>
{!rowNum},<apex:outputText value=”aVal1,aVal2,aVal3″/><apex:variable var=”rowNum” value=”{!rowNum+1}”/>
{!rowNum},<apex:outputText value=”bVal1,bVal2,bVal3″/><apex:variable var=”rowNum” value=”{!rowNum+1}”/>
{!rowNum},<apex:outputText value=”bVal1,bVal2,bVal3″/><apex:variable var=”rowNum” value=”{!rowNum+1}”/>
{!rowNum},<apex:outputText value=”bVal1,bVal2,bVal3″/><apex:variable var=”rowNum” value=”{!rowNum+1}”/>
{!rowNum},<apex:outputText value=”bVal1,bVal2,bVal3″/><apex:variable var=”rowNum” value=”{!rowNum+1}”/>
</apex:page>
Thanks