You need to sign in to do that
Don't have an account?
Girinoob
Visualforce page render as Excel issues
Hi,
I am generating visualforce page as Excel by adding "contenttype="application/vnd.ms-excel"" in the <apex:page> tag. The excel is getting generated but formatting is bad... how do i format ? Can anyone give me example.
I got an solution. We should not use CSS 0r style class, instead of that we should do inline styling.
Check my code below:
<table width="100%"id="table1"border="0">
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<th colspan='2'><font size="2" face="Arial Unicode MS">xxxxx</font></th>
<th colspan='4'><font size="2" face="Arial Unicode MS">yyyyyy</font></th>
</tr>
<trstyle="font-size:10pt;">
<th colspan="2">
<fontsize="2"face="Arial Unicode MS">Name</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">ID</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Current</font><br/><fontsize="2"face="Arial Unicode MS"> Grade</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS"></font><fontsize="2"face="Arial Unicode MS">HR</font>
</th>
<th colspan="2">
<fontsize="2"face="Arial Unicode MS">Phone #</font><br/><fontsize="2"face="Arial Unicode MS">from DOE</font>
</th>
<th colspan="2">
<font size="2" face="Arial Unicode MS">Alternate Phone</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Attended</font><br/><fontsize="2"face="Arial Unicode MS">FLW</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">At FLW</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Last Known</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Application</font><br/><fontsize="2"face="Arial Unicode MS">Status</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS"># of Calls</font><br/><fontsize="2"face="Arial Unicode MS">Made by CFY</font>
</th>
<thcolspan="2">
<fontsize="2"face="Arial Unicode MS">Outcome of Most</font><br/><fontsize="2"face="Arial Unicode MS">Recent Call</font>
</th>
</tr>
<apex:repeatvalue="{!listOfContactsWrapper}"var="lcw"id="theList">
<apex:repeatvalue="{!lcw.cw}"var="con">
<trbgcolor="{!con.rowColor}">
<td align="center" colspan="2"> <font size="1" face="Arial Unicode MS">{!con.contact.lastname}, {!con.contact.firstname}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.contact.X_ID__c}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.contact.Grade_Text__c}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.contact.Homeroom__c}</font></td>
<td align="center" colspan="2"><font size="1" face="Arial Unicode MS">{!con.contact.DOE_Phone_number__c}</font></td>
<tdcolspan="2"align="center"><fontsize="1"face="Arial Unicode MS">{!con.contact.Phone}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.attendedWorkshopStatus}</font></td>
<tdalign="center"><fontsize="1"face="Arial Unicode MS">{!con.atFLWStatus}</font></td>
<tdalign="center"><fontsize="1"face="Arial Unicode MS">{!con.lastKnown}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.applicationStatus}</font></td>
<td align="center" ><font size="1" face="Arial Unicode MS">{!con.numberOfCalls}</font></td>
<td align="center" colspan="2"><font size="1" face="Arial Unicode MS">{!con.recentCallNotes}</font></td>
</tr>
</apex:repeat>
</apex:repeat>
</table>
All Answers
Just curious, did you got to an solution to this? I am facing the same problem :(
I got an solution. We should not use CSS 0r style class, instead of that we should do inline styling.
Check my code below:
<table width="100%"id="table1"border="0">
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<th colspan='2'><font size="2" face="Arial Unicode MS">xxxxx</font></th>
<th colspan='4'><font size="2" face="Arial Unicode MS">yyyyyy</font></th>
</tr>
<trstyle="font-size:10pt;">
<th colspan="2">
<fontsize="2"face="Arial Unicode MS">Name</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">ID</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Current</font><br/><fontsize="2"face="Arial Unicode MS"> Grade</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS"></font><fontsize="2"face="Arial Unicode MS">HR</font>
</th>
<th colspan="2">
<fontsize="2"face="Arial Unicode MS">Phone #</font><br/><fontsize="2"face="Arial Unicode MS">from DOE</font>
</th>
<th colspan="2">
<font size="2" face="Arial Unicode MS">Alternate Phone</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Attended</font><br/><fontsize="2"face="Arial Unicode MS">FLW</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">At FLW</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Last Known</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS">Application</font><br/><fontsize="2"face="Arial Unicode MS">Status</font>
</th>
<th >
<fontsize="2"face="Arial Unicode MS"># of Calls</font><br/><fontsize="2"face="Arial Unicode MS">Made by CFY</font>
</th>
<thcolspan="2">
<fontsize="2"face="Arial Unicode MS">Outcome of Most</font><br/><fontsize="2"face="Arial Unicode MS">Recent Call</font>
</th>
</tr>
<apex:repeatvalue="{!listOfContactsWrapper}"var="lcw"id="theList">
<apex:repeatvalue="{!lcw.cw}"var="con">
<trbgcolor="{!con.rowColor}">
<td align="center" colspan="2"> <font size="1" face="Arial Unicode MS">{!con.contact.lastname}, {!con.contact.firstname}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.contact.X_ID__c}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.contact.Grade_Text__c}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.contact.Homeroom__c}</font></td>
<td align="center" colspan="2"><font size="1" face="Arial Unicode MS">{!con.contact.DOE_Phone_number__c}</font></td>
<tdcolspan="2"align="center"><fontsize="1"face="Arial Unicode MS">{!con.contact.Phone}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.attendedWorkshopStatus}</font></td>
<tdalign="center"><fontsize="1"face="Arial Unicode MS">{!con.atFLWStatus}</font></td>
<tdalign="center"><fontsize="1"face="Arial Unicode MS">{!con.lastKnown}</font></td>
<td align="center"><font size="1" face="Arial Unicode MS">{!con.applicationStatus}</font></td>
<td align="center" ><font size="1" face="Arial Unicode MS">{!con.numberOfCalls}</font></td>
<td align="center" colspan="2"><font size="1" face="Arial Unicode MS">{!con.recentCallNotes}</font></td>
</tr>
</apex:repeat>
</apex:repeat>
</table>
how to use the repeat tag in the repeat tag,can you explian?