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
Naveen AdminNaveen Admin 

Please look into this tag and tell me how too do is..

<Worksheet ss:Name="Contacts">
 There is a requirement that i have to give color to Worksheet name tab...Please tell me how to do it...
bob_buzzardbob_buzzard
This doesn't look like a visualforce tag - are you sure you've posted in the correct forum?
Naveen AdminNaveen Admin
Its XML tag....I need to colorize the Excel Worksheet tab through XML code...I have found a tag<TabColorIndex> to do that but I have Multiple sheets It works only for single page i dont Know y....Here is my code please go through it...


<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">
<Styles>
   <Style ss:ID="s1">
   <Alignment/>
   <Borders/>
   <Font ss:Bold="1" ss:Color="RED"/>
   <Interior ss:Pattern='Solid' ss:Color="#B8B8B8"/>
    <NumberFormat/>
    <Protection/>
  </Style>
    
   <Style ss:ID="s2">
   <Alignment/>
   <Borders/>
   <Font ss:Color="BLUE"/> 
    <NumberFormat/>
    <Protection/>
   </Style>
   <Style ss:ID="s3">
   <Alignment/>
   <Borders/>
   <Font ss:Bold="1" ss:Color="RED"/>
   <Interior ss:Pattern='Solid' ss:Color="#B8B8B8"/>
    <NumberFormat/>
    <Protection/>
  </Style>
   </Styles>
   
    <Worksheet ss:Name="Accounts"> <!-- -------------------------------------- Ishould give color to this tab------------------------------------------------------>
<Table x:FullColumns="1" x:FullRows="1">
  <Column ss:Width="170"/>
  <Row>
<Cell ss:StyleID="s1"><Data ss:Type="String" >Account Name</Data></Cell>
</Row>
  <apex:repeat value="{!accountList}" var="account">
  <Row>
<Cell><Data ss:Type="String">{!account.name}</Data></Cell>
</Row>
</apex:repeat>
</Table>
</Worksheet>


<Worksheet ss:Name="Contacts"> <!-- -------------------------------------- Ishould give color to this tab------------------------------------------------------>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<TabColorIndex>21</TabColorIndex>
<Selected/>
<FreezePanes/>
<FrozenNoSplit/>

<!--- Right-most column number of left pane. --->
<SplitVertical>1</SplitVertical>
<SplitVertical>2</SplitVertical>
<!---
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>
<LeftColumnRightPane>2</LeftColumnRightPane> 
</WorksheetOptions>
<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"><Data ss:Type="String">Contact Name</Data></Cell>
   <Cell ss:StyleID="s1"><Data ss:Type="String" >Last Name</Data></Cell>
   <Cell ss:StyleID="s1"><Data ss:Type="String" >Account Name</Data></Cell>
   <Cell ss:StyleID="s1" ><Data ss:Type="String" >Created Date</Data></Cell>
  </Row>
  <apex:repeat value="{!contactList}" var="contact">
  <Row>
  <Cell ss:StyleID="s2"><Data ss:Type="String">{!contact.name}</Data></Cell>
<Cell><Data ss:Type="String">{!contact.lastName}</Data></Cell>
<Cell ><Data ss:Type="String">{!contact.account.name}</Data></Cell>
<Cell><Data ss:Type="String"><apex:outputText value=" {0,date,M/d/yyy, h:mm a}">
    <apex:param value="{!contact.CreatedDate}" />
</apex:outputText></Data></Cell>
   </Row>
</apex:repeat>
</Table>
</Worksheet> 
</Workbook>
</apex:page>