Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please help...PRovide me the simplest way to do it...
Posted
Comments
Richard MacCutchan 8-May-14 10:59am    
What cell, what condition, where will it be displayed, what programming language are you using ... ?

Please provide proper details of your problem.
Member 10804304 9-May-14 8:10am    
Hi Richard MacCutchan,
I am using Apex language,There is a requierement that the clor has to display dynamically based on the column value like if 10% green ,if 20% red so on....I took an example code tried to change color in the cell based on condition Account name = "Some name"....But i am not getting How to put condition there...Here is my example code Visualforce page code....


<apex:page controller="ExcelControllerCheck2" contenttype="txt/xml#myTest.xls" cache="true">
<apex:outputtext value="{!xlsHeader}">

<workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
="" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<Styles>
<Style ss:ID="s1">
<alignment>
<borders>

<interior ss:pattern="Solid" ss:color="#B8B8B8">
<numberformat>
<Protection/>
</Style>

<Style ss:ID="s2">
<alignment>
<borders>

<numberformat>
<Protection/>
</Style>


<!--
<Style ss:ID="s2">
<alignment>
<borders>


<interior ss:color="Gray75">
<numberformat>
<Protection/>
</Style>
-->
</Styles>

<worksheet ss:name="Accounts" ss:styleid="s1">
<Table x:FullColumns="1" x:FullRows="1">
<column ss:width="170">
<row>
<cell ss:styleid="s1">Account Name

<apex:repeat value="{!accountList}" var="account">
<row>
<cell>{!account.name}


</Table>


<worksheet ss:name="Contacts">

<worksheetoptions
xmlns="urn:schemas-microsoft-com:office:excel">
<Selected/>
<freezepanes>
<frozennosplit>

<!--- Right-most column number of left pane. --->
<splitvertical>1
<splitvertical>2
<!---
Offset column of right frame. This is not the actual
column number of the overall Excel document, but rather
the index of the available column for this pane. This
number cannot exclude columns, it can merely set the
offset scroll of this pane. (1) scrolls to the left of
the frame (first column).
--->
<leftcolumnrightpane>1
<leftcolumnrightpane>2


<Table x:FullColumns="1" x:FullRows="1">
<column ss:width="170">
<column ss:width="280">
<column ss:width="330">
<column ss:width="550">
<row>
<cell ss:styleid="s1">Contact Name
<cell ss:styleid="s1">Last Name
<cell ss:styleid="s1">Account Name
<cell ss:styleid="s1">Created Date

<apex:repeat value="{!contactList}" var="contact">
<row>
<cell ss:styleid="s2">{!contact.name}
<cell>{!contact.lastName}
<cell>{!contact.account.name}
<cell><apex:outputtext value=" {0,date,M/d/yyy, h:mm a}">
<apex:param value="{!contact.CreatedDate}">



</Table>







And also if possible tell me how to change Worksheet name color?ex:<worksheet ss:name="Account">
i want to give color to this worksheet name....Please help me....
Member 10804304 9-May-14 8:12am    
<apex:page controller="ExcelControllerCheck2" contenttype="txt/xml#myTest.xls" cache="true">
<apex:outputtext value="{!xlsHeader}">
<workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
="" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<Styles>
<Style ss:ID="s1">
<alignment>
<borders>

<interior ss:pattern="Solid" ss:color="#B8B8B8">
<numberformat>
<Protection/>
</Style>
<Style ss:ID="s2">
<alignment>
<borders>

<numberformat>
<Protection/>
</Style>
<!--
<Style ss:ID="s2">
<alignment>
<borders>

<interior ss:color="Gray75">
<numberformat>
<Protection/>
</Style>
-->
</Styles>
<worksheet ss:name="Accounts" ss:styleid="s1">
<Table x:FullColumns="1" x:FullRows="1">
<column ss:width="170">
<row>
<cell ss:styleid="s1">Account Name

<apex:repeat value="{!accountList}" var="account">
<row>
<cell>{!account.name}


</Table>

<worksheet ss:name="Contacts">
<worksheetoptions
xmlns="urn:schemas-microsoft-com:office:excel">
<Selected/>
<freezepanes>
<frozennosplit>
<!--- Right-most column number of left pane. --->
<splitvertical>1
<splitvertical>2
<!---
Offset column of right frame. This is not the actual
column number of the overall Excel document, but rather
the index of the available column for this pane. This
number cannot exclude columns, it can merely set the
offset scroll of this pane. (1) scrolls to the left of
the frame (first column).
--->
<leftcolumnrightpane>1
<leftcolumnrightpane>2

<Table x:FullColumns="1" x:FullRows="1">
<column ss:width="170">
<column ss:width="280">
<column ss:width="330">
<column ss:width="550">
<row>
<cell ss:styleid="s1">Contact Name
<cell ss:styleid="s1">Last Name
<cell ss:styleid="s1">Account Name
<cell ss:styleid="s1">Created Date

<apex:repeat value="{!contactList}" var="contact">
<row>
<cell ss:styleid="s2">{!contact.name}
<cell>{!contact.lastName}
<cell>{!contact.account.name}
<cell><apex:outputtext value=" {0,date,M/d/yyy, h:mm a}">
<apex:param value="{!contact.CreatedDate}">



</Table>


Richard MacCutchan 9-May-14 8:21am    
Sorry, I have no experience of Apex.
Richard MacCutchan 9-May-14 8:22am    
It would also help if you added this code (properly formatted) into your original question so that people can understand what you are trying to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900