Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I am using #003134 Hex color code in XSLT as below

<Style ss:ID="s2">
  <Alignment ss:Vertical="Center"/>
  <Font ss:FontName="Arial" ss:Size="14" ss:Color="#003134" ss:Bold="1"/>
</Style>

And I am calling it as below:
<xsl:template match="/*">
<Worksheet ss:Name="Summary">
<Row ss:AutoFitHeight="0" ss:Height="33">
  <Cell ss:MergeAcross="1" ss:StyleID="s2">
    <Data ss:Type="String">My Company</Data>
  </Cell>
</Row>
</Worksheet>
</xsl:template>


But After downloading excel, the color has changed to #003366

I tried most of the possible ways but couldn't fix it. Your help or suggestion on this would be appreciated.

Regards,
Raj

What I have tried:

Googled it and also searched for many articles but did not get any solution. I tried in stack overflow and code project forums as well
Posted
Updated 9-Feb-23 22:25pm
Comments
Andre Oosthuizen 10-Feb-23 0:59am    
This might help - https://stackoverflow.com/questions/24118320/excel-spreadsheet-dynamic-cell-colouring-using-xml-and-xslt

1 solution

The XML format you're using comes from Excel 2003, which was limited to a palette of 56 colours. Any colours not in the palette will be mapped to the nearest match.

You can see the palette here:
Color Palette and the 56 Excel ColorIndex Colors[^]

I haven't seen any way to override the palette with this file format. If you need custom colours, then you'll probably need to use The OpenXML SDK[^] to generate your spreadsheet instead.
 
Share this answer
 

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