Wednesday, March 21, 2012

HELP! Need a Light Green color that exports

I have a report that needs to have a green cell (based on a condition of
course - which is decided in a code function) Here is my function:
Public Function SetColor(ByVal N As Double) As String
Select N
Case 0
Return "Salmon"
Case 1
Return "PaleGoldenrod"
Case 2
Return "LightGreen"
Case 3
Return "RoyalBlue"
Case Else
Return "Transparent"
End Select
End Function
All of the colors work *except* LightGreen. I can even *see* Light Green
in the excel color palette (notice the "space" in the excel color name) ... I
dont even *see* Salmon, Palegoldenrod or anything else there ... and yet
*those* show properly. It is only the green color that shows wrong and it
displays as GREY. Not good. I have tried other light green colors but the
only GREEN I can get to work is GREEN and that is too dark. Can someone help
with this? TIA ...Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
#80ff80.
Case 0
Return "#80ff80"
I would have used hex codes for all colours that are not plain red, yellow,
blue and green, just to be sure it was rendered OK.
Kaisa M. Lindahl Lervik
"MJT" <MJT@.discussions.microsoft.com> wrote in message
news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
>I have a report that needs to have a green cell (based on a condition of
> course - which is decided in a code function) Here is my function:
> Public Function SetColor(ByVal N As Double) As String
> Select N
> Case 0
> Return "Salmon"
> Case 1
> Return "PaleGoldenrod"
> Case 2
> Return "LightGreen"
> Case 3
> Return "RoyalBlue"
> Case Else
> Return "Transparent"
> End Select
> End Function
> All of the colors work *except* LightGreen. I can even *see* Light Green
> in the excel color palette (notice the "space" in the excel color name)
> ... I
> dont even *see* Salmon, Palegoldenrod or anything else there ... and yet
> *those* show properly. It is only the green color that shows wrong and it
> displays as GREY. Not good. I have tried other light green colors but
> the
> only GREEN I can get to work is GREEN and that is too dark. Can someone
> help
> with this? TIA ...
>|||Thanks Kaisa ... I will try that. How can I find the hex codes for the
palette colors in reporting services? For instance what PaleGoldenrod is.
"Kaisa M. Lindahl Lervik" wrote:
> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
> #80ff80.
> Case 0
> Return "#80ff80"
> I would have used hex codes for all colours that are not plain red, yellow,
> blue and green, just to be sure it was rendered OK.
> Kaisa M. Lindahl Lervik
>
> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
> >I have a report that needs to have a green cell (based on a condition of
> > course - which is decided in a code function) Here is my function:
> >
> > Public Function SetColor(ByVal N As Double) As String
> >
> > Select N
> > Case 0
> > Return "Salmon"
> > Case 1
> > Return "PaleGoldenrod"
> > Case 2
> > Return "LightGreen"
> > Case 3
> > Return "RoyalBlue"
> > Case Else
> > Return "Transparent"
> >
> > End Select
> >
> > End Function
> >
> > All of the colors work *except* LightGreen. I can even *see* Light Green
> > in the excel color palette (notice the "space" in the excel color name)
> > ... I
> > dont even *see* Salmon, Palegoldenrod or anything else there ... and yet
> > *those* show properly. It is only the green color that shows wrong and it
> > displays as GREY. Not good. I have tried other light green colors but
> > the
> > only GREEN I can get to work is GREEN and that is too dark. Can someone
> > help
> > with this? TIA ...
> >
> >
>
>|||I'm not sure, I thought you could use the .Net object browser, but I didn't
see the hex codes.
System.Drawing.Color has the color enum that you are looking for.
Ah, here's a page:
http://www.opinionatedgeek.com/DotNet/Tools/Colors/default.aspx
"MJT" <MJT@.discussions.microsoft.com> wrote in message
news:0260F30C-FB37-4186-8501-E93516FD7C89@.microsoft.com...
> Thanks Kaisa ... I will try that. How can I find the hex codes for the
> palette colors in reporting services? For instance what PaleGoldenrod is.
> "Kaisa M. Lindahl Lervik" wrote:
>> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
>> #80ff80.
>> Case 0
>> Return "#80ff80"
>> I would have used hex codes for all colours that are not plain red,
>> yellow,
>> blue and green, just to be sure it was rendered OK.
>> Kaisa M. Lindahl Lervik
>>
>> "MJT" <MJT@.discussions.microsoft.com> wrote in message
>> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
>> >I have a report that needs to have a green cell (based on a condition of
>> > course - which is decided in a code function) Here is my function:
>> >
>> > Public Function SetColor(ByVal N As Double) As String
>> >
>> > Select N
>> > Case 0
>> > Return "Salmon"
>> > Case 1
>> > Return "PaleGoldenrod"
>> > Case 2
>> > Return "LightGreen"
>> > Case 3
>> > Return "RoyalBlue"
>> > Case Else
>> > Return "Transparent"
>> >
>> > End Select
>> >
>> > End Function
>> >
>> > All of the colors work *except* LightGreen. I can even *see* Light
>> > Green
>> > in the excel color palette (notice the "space" in the excel color name)
>> > ... I
>> > dont even *see* Salmon, Palegoldenrod or anything else there ... and
>> > yet
>> > *those* show properly. It is only the green color that shows wrong and
>> > it
>> > displays as GREY. Not good. I have tried other light green colors but
>> > the
>> > only GREEN I can get to work is GREEN and that is too dark. Can
>> > someone
>> > help
>> > with this? TIA ...
>> >
>> >
>>|||Thank you Steve ... that is exactly what I needed!!! Between you and Kaisa I
am all set now. Thanks to you both!!
"Steve MunLeeuw" wrote:
> I'm not sure, I thought you could use the .Net object browser, but I didn't
> see the hex codes.
> System.Drawing.Color has the color enum that you are looking for.
> Ah, here's a page:
> http://www.opinionatedgeek.com/DotNet/Tools/Colors/default.aspx
>
>
> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> news:0260F30C-FB37-4186-8501-E93516FD7C89@.microsoft.com...
> > Thanks Kaisa ... I will try that. How can I find the hex codes for the
> > palette colors in reporting services? For instance what PaleGoldenrod is.
> >
> > "Kaisa M. Lindahl Lervik" wrote:
> >
> >> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
> >> #80ff80.
> >>
> >> Case 0
> >> Return "#80ff80"
> >>
> >> I would have used hex codes for all colours that are not plain red,
> >> yellow,
> >> blue and green, just to be sure it was rendered OK.
> >>
> >> Kaisa M. Lindahl Lervik
> >>
> >>
> >> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> >> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
> >> >I have a report that needs to have a green cell (based on a condition of
> >> > course - which is decided in a code function) Here is my function:
> >> >
> >> > Public Function SetColor(ByVal N As Double) As String
> >> >
> >> > Select N
> >> > Case 0
> >> > Return "Salmon"
> >> > Case 1
> >> > Return "PaleGoldenrod"
> >> > Case 2
> >> > Return "LightGreen"
> >> > Case 3
> >> > Return "RoyalBlue"
> >> > Case Else
> >> > Return "Transparent"
> >> >
> >> > End Select
> >> >
> >> > End Function
> >> >
> >> > All of the colors work *except* LightGreen. I can even *see* Light
> >> > Green
> >> > in the excel color palette (notice the "space" in the excel color name)
> >> > ... I
> >> > dont even *see* Salmon, Palegoldenrod or anything else there ... and
> >> > yet
> >> > *those* show properly. It is only the green color that shows wrong and
> >> > it
> >> > displays as GREY. Not good. I have tried other light green colors but
> >> > the
> >> > only GREEN I can get to work is GREEN and that is too dark. Can
> >> > someone
> >> > help
> >> > with this? TIA ...
> >> >
> >> >
> >>
> >>
> >>
>
>|||I tried using the hex codes and it didnt work. I thought it should too!
What could I be doing wrong? I have a conditional expression in addition to
the function in the cell ... maybe it has something to do with that:
=IIF(IsNothing(Fields!PERCENT.Value), "white", code.SetColor(
Fields!PerformanceValue.Value))
It is not setting all cells to white ... so it isnt the behavior I have seen
written about elsewhere in this newsgroup. I tried "#90EE90" and "#80ff80"
and I still see grey where green should appear. Any other suggestions?
"Steve MunLeeuw" wrote:
> I'm not sure, I thought you could use the .Net object browser, but I didn't
> see the hex codes.
> System.Drawing.Color has the color enum that you are looking for.
> Ah, here's a page:
> http://www.opinionatedgeek.com/DotNet/Tools/Colors/default.aspx
>
>
> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> news:0260F30C-FB37-4186-8501-E93516FD7C89@.microsoft.com...
> > Thanks Kaisa ... I will try that. How can I find the hex codes for the
> > palette colors in reporting services? For instance what PaleGoldenrod is.
> >
> > "Kaisa M. Lindahl Lervik" wrote:
> >
> >> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
> >> #80ff80.
> >>
> >> Case 0
> >> Return "#80ff80"
> >>
> >> I would have used hex codes for all colours that are not plain red,
> >> yellow,
> >> blue and green, just to be sure it was rendered OK.
> >>
> >> Kaisa M. Lindahl Lervik
> >>
> >>
> >> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> >> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
> >> >I have a report that needs to have a green cell (based on a condition of
> >> > course - which is decided in a code function) Here is my function:
> >> >
> >> > Public Function SetColor(ByVal N As Double) As String
> >> >
> >> > Select N
> >> > Case 0
> >> > Return "Salmon"
> >> > Case 1
> >> > Return "PaleGoldenrod"
> >> > Case 2
> >> > Return "LightGreen"
> >> > Case 3
> >> > Return "RoyalBlue"
> >> > Case Else
> >> > Return "Transparent"
> >> >
> >> > End Select
> >> >
> >> > End Function
> >> >
> >> > All of the colors work *except* LightGreen. I can even *see* Light
> >> > Green
> >> > in the excel color palette (notice the "space" in the excel color name)
> >> > ... I
> >> > dont even *see* Salmon, Palegoldenrod or anything else there ... and
> >> > yet
> >> > *those* show properly. It is only the green color that shows wrong and
> >> > it
> >> > displays as GREY. Not good. I have tried other light green colors but
> >> > the
> >> > only GREEN I can get to work is GREEN and that is too dark. Can
> >> > someone
> >> > help
> >> > with this? TIA ...
> >> >
> >> >
> >>
> >>
> >>
>
>|||I tried it and it actually did not work. I think there is something else I
need to do to fix it in addition. I have a conditional expression deciding
whether to perform the function (because I could have nulls in the cell but I
am replacing them with the words "No Data") So the expression in the data
cell is this (it is a matrix cell)
=IIF(IsNothing(Fields!PERCENT.Value), "No Data",
Sum(Fields!PERCENT.Value)/100 )
and the expression for the background color to be set for this cell is this:
=IIF(IsNothing(Fields!PERCENT.Value), "white", code.SetColor(
Fields!PerformanceValue.Value))
and the Function is this:
Public Function SetColor(ByVal N As Double) As String
Select N
Case 0
Return "Salmon"
Case 1
Return "PaleGoldenrod"
Case 2
Return "LightGreen"
Case 3
Return "RoyalBlue"
Case Else
Return "Transparent"
End Select
End Function
I tried changing the function to return values "#90EE90" etc and I altered
the IIF statement to read "#FFFFFF" instead of "white" ... but that didnt
work - it rendered correctly except didnt export to excel and show green ...
it still showed grey. I did get a warning message "The background color
expression used in textbox â'textbox8â' returned a data type that is not valid"
- textbox 8 is the cell I am using. I know when I have used hex codes for
colors in the past ... I dont believe I enclosed them in quotes in the cell,
but I cant return #90EE90 from my function without putting quotes around it,
can I? What would you do next?
"Kaisa M. Lindahl Lervik" wrote:
> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
> #80ff80.
> Case 0
> Return "#80ff80"
> I would have used hex codes for all colours that are not plain red, yellow,
> blue and green, just to be sure it was rendered OK.
> Kaisa M. Lindahl Lervik
>
> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
> >I have a report that needs to have a green cell (based on a condition of
> > course - which is decided in a code function) Here is my function:
> >
> > Public Function SetColor(ByVal N As Double) As String
> >
> > Select N
> > Case 0
> > Return "Salmon"
> > Case 1
> > Return "PaleGoldenrod"
> > Case 2
> > Return "LightGreen"
> > Case 3
> > Return "RoyalBlue"
> > Case Else
> > Return "Transparent"
> >
> > End Select
> >
> > End Function
> >
> > All of the colors work *except* LightGreen. I can even *see* Light Green
> > in the excel color palette (notice the "space" in the excel color name)
> > ... I
> > dont even *see* Salmon, Palegoldenrod or anything else there ... and yet
> > *those* show properly. It is only the green color that shows wrong and it
> > displays as GREY. Not good. I have tried other light green colors but
> > the
> > only GREEN I can get to work is GREEN and that is too dark. Can someone
> > help
> > with this? TIA ...
> >
> >
>
>|||I will report back that I now have it working. I cant tell you what fixed
it ... maybe changing the case of the letters in hex? Thats about all I did.
Here is the expression that works.
=IIF(IsNothing(Fields!PERCENT.Value), "#ffffff", code.SetColor(
Fields!PerformanceValue.Value))
AND the function code:
Public Function SetColor(ByVal N As Double) As String
Select N
Case 0
Return "#fa8072"
Case 1
Return "#eee8aa"
Case 2
Return "#c0ffc0"
Case 3
Return "#4169e1"
Case Else
Return "#ffffff"
End Select
End Function
Thanks for all of your help!! I guess case was important in this CASE ...
pun intended!
"MJT" wrote:
> I tried using the hex codes and it didnt work. I thought it should too!
> What could I be doing wrong? I have a conditional expression in addition to
> the function in the cell ... maybe it has something to do with that:
> =IIF(IsNothing(Fields!PERCENT.Value), "white", code.SetColor(
> Fields!PerformanceValue.Value))
> It is not setting all cells to white ... so it isnt the behavior I have seen
> written about elsewhere in this newsgroup. I tried "#90EE90" and "#80ff80"
> and I still see grey where green should appear. Any other suggestions?
> "Steve MunLeeuw" wrote:
> > I'm not sure, I thought you could use the .Net object browser, but I didn't
> > see the hex codes.
> >
> > System.Drawing.Color has the color enum that you are looking for.
> > Ah, here's a page:
> >
> > http://www.opinionatedgeek.com/DotNet/Tools/Colors/default.aspx
> >
> >
> >
> >
> > "MJT" <MJT@.discussions.microsoft.com> wrote in message
> > news:0260F30C-FB37-4186-8501-E93516FD7C89@.microsoft.com...
> > > Thanks Kaisa ... I will try that. How can I find the hex codes for the
> > > palette colors in reporting services? For instance what PaleGoldenrod is.
> > >
> > > "Kaisa M. Lindahl Lervik" wrote:
> > >
> > >> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
> > >> #80ff80.
> > >>
> > >> Case 0
> > >> Return "#80ff80"
> > >>
> > >> I would have used hex codes for all colours that are not plain red,
> > >> yellow,
> > >> blue and green, just to be sure it was rendered OK.
> > >>
> > >> Kaisa M. Lindahl Lervik
> > >>
> > >>
> > >> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> > >> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
> > >> >I have a report that needs to have a green cell (based on a condition of
> > >> > course - which is decided in a code function) Here is my function:
> > >> >
> > >> > Public Function SetColor(ByVal N As Double) As String
> > >> >
> > >> > Select N
> > >> > Case 0
> > >> > Return "Salmon"
> > >> > Case 1
> > >> > Return "PaleGoldenrod"
> > >> > Case 2
> > >> > Return "LightGreen"
> > >> > Case 3
> > >> > Return "RoyalBlue"
> > >> > Case Else
> > >> > Return "Transparent"
> > >> >
> > >> > End Select
> > >> >
> > >> > End Function
> > >> >
> > >> > All of the colors work *except* LightGreen. I can even *see* Light
> > >> > Green
> > >> > in the excel color palette (notice the "space" in the excel color name)
> > >> > ... I
> > >> > dont even *see* Salmon, Palegoldenrod or anything else there ... and
> > >> > yet
> > >> > *those* show properly. It is only the green color that shows wrong and
> > >> > it
> > >> > displays as GREY. Not good. I have tried other light green colors but
> > >> > the
> > >> > only GREEN I can get to work is GREEN and that is too dark. Can
> > >> > someone
> > >> > help
> > >> > with this? TIA ...
> > >> >
> > >> >
> > >>
> > >>
> > >>
> >
> >
> >|||Hmmm, I wonder if it's running into a problem with the IIF(). If you put
the output out as text, rather than trying to set the color, are you getting
the color hex values you expect? If that's working correctly, try not using
the expression and seeing if you can set the background color to the light
green value that isn't working....If that is failing, then you know it's
not the expression and it's a bug or limitation in the excel rendering
engine. I'm using...was using LightGreen ( I swear) and it was rendering
to PDF just fine, not sure about Excel, never tested. I'd try exporting to
PDF and see if that works. If this helps, here's the code I'm using to set
the color of the chart bars.
public static Int32 PickColor(int index)
{
Int32 ReturnVal = Color.Tan.ToArgb();
switch (index)
{
case 0:
ReturnVal = Color.MediumSlateBlue.ToArgb();
break;
case 1:
ReturnVal = Color.MediumVioletRed.ToArgb();
break;
case 2:
ReturnVal = Color.LightYellow.ToArgb();
break;
case 3:
ReturnVal = Color.PaleTurquoise.ToArgb();
break;
case 4:
ReturnVal = Color.Purple.ToArgb();
break;
}
return ReturnVal;
}
"MJT" <MJT@.discussions.microsoft.com> wrote in message
news:CE2F86F8-6482-4CB0-A8A7-3D3A8E13FD06@.microsoft.com...
>I tried it and it actually did not work. I think there is something else I
> need to do to fix it in addition. I have a conditional expression
> deciding
> whether to perform the function (because I could have nulls in the cell
> but I
> am replacing them with the words "No Data") So the expression in the data
> cell is this (it is a matrix cell)
> =IIF(IsNothing(Fields!PERCENT.Value), "No Data",
> Sum(Fields!PERCENT.Value)/100 )
> and the expression for the background color to be set for this cell is
> this:
> =IIF(IsNothing(Fields!PERCENT.Value), "white", code.SetColor(
> Fields!PerformanceValue.Value))
> and the Function is this:
> Public Function SetColor(ByVal N As Double) As String
> Select N
> Case 0
> Return "Salmon"
> Case 1
> Return "PaleGoldenrod"
> Case 2
> Return "LightGreen"
> Case 3
> Return "RoyalBlue"
> Case Else
> Return "Transparent"
> End Select
> End Function
> I tried changing the function to return values "#90EE90" etc and I altered
> the IIF statement to read "#FFFFFF" instead of "white" ... but that didnt
> work - it rendered correctly except didnt export to excel and show green
> ...
> it still showed grey. I did get a warning message "The background color
> expression used in textbox 'textbox8' returned a data type that is not
> valid"
> - textbox 8 is the cell I am using. I know when I have used hex codes for
> colors in the past ... I dont believe I enclosed them in quotes in the
> cell,
> but I cant return #90EE90 from my function without putting quotes around
> it,
> can I? What would you do next?
>
> "Kaisa M. Lindahl Lervik" wrote:
>> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
>> #80ff80.
>> Case 0
>> Return "#80ff80"
>> I would have used hex codes for all colours that are not plain red,
>> yellow,
>> blue and green, just to be sure it was rendered OK.
>> Kaisa M. Lindahl Lervik
>>
>> "MJT" <MJT@.discussions.microsoft.com> wrote in message
>> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
>> >I have a report that needs to have a green cell (based on a condition of
>> > course - which is decided in a code function) Here is my function:
>> >
>> > Public Function SetColor(ByVal N As Double) As String
>> >
>> > Select N
>> > Case 0
>> > Return "Salmon"
>> > Case 1
>> > Return "PaleGoldenrod"
>> > Case 2
>> > Return "LightGreen"
>> > Case 3
>> > Return "RoyalBlue"
>> > Case Else
>> > Return "Transparent"
>> >
>> > End Select
>> >
>> > End Function
>> >
>> > All of the colors work *except* LightGreen. I can even *see* Light
>> > Green
>> > in the excel color palette (notice the "space" in the excel color name)
>> > ... I
>> > dont even *see* Salmon, Palegoldenrod or anything else there ... and
>> > yet
>> > *those* show properly. It is only the green color that shows wrong and
>> > it
>> > displays as GREY. Not good. I have tried other light green colors but
>> > the
>> > only GREEN I can get to work is GREEN and that is too dark. Can
>> > someone
>> > help
>> > with this? TIA ...
>> >
>> >
>>|||Steve,
read my post that is a couple of lines up in the thread (2/24) that tells
you I got it working. The only thing I can figure out is it might be the
case I was using. I tried many things ... I took out the IIF statement to
see what would export correctly in hex and for whatever reason it didnt seem
to like #90EE90 for light green but it accepted #C0FFCO ... and I noticed in
reporting services that when I chose a hex code from their custom colors ( I
started with what they had predefined before going to the "web colors" tab)
it made the hex value lower case #c0ffc0 ... and it exported and showed
correctly. So I changed the case of the hex letters in my function and it
seemed to work. Strange. I am snipping your code though. Must be c# ...
doesnt look like vb .net. I love it when people submit examples of code ...
I am just learning and it is so helpful to collect examples. Thanks for your
help! remember to use lower case hex letters ... lol
"Steve MunLeeuw" wrote:
> Hmmm, I wonder if it's running into a problem with the IIF(). If you put
> the output out as text, rather than trying to set the color, are you getting
> the color hex values you expect? If that's working correctly, try not using
> the expression and seeing if you can set the background color to the light
> green value that isn't working....If that is failing, then you know it's
> not the expression and it's a bug or limitation in the excel rendering
> engine. I'm using...was using LightGreen ( I swear) and it was rendering
> to PDF just fine, not sure about Excel, never tested. I'd try exporting to
> PDF and see if that works. If this helps, here's the code I'm using to set
> the color of the chart bars.
> public static Int32 PickColor(int index)
> {
> Int32 ReturnVal = Color.Tan.ToArgb();
> switch (index)
> {
> case 0:
> ReturnVal = Color.MediumSlateBlue.ToArgb();
> break;
> case 1:
> ReturnVal = Color.MediumVioletRed.ToArgb();
> break;
> case 2:
> ReturnVal = Color.LightYellow.ToArgb();
> break;
> case 3:
> ReturnVal = Color.PaleTurquoise.ToArgb();
> break;
> case 4:
> ReturnVal = Color.Purple.ToArgb();
> break;
> }
> return ReturnVal;
> }
>
>
> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> news:CE2F86F8-6482-4CB0-A8A7-3D3A8E13FD06@.microsoft.com...
> >I tried it and it actually did not work. I think there is something else I
> > need to do to fix it in addition. I have a conditional expression
> > deciding
> > whether to perform the function (because I could have nulls in the cell
> > but I
> > am replacing them with the words "No Data") So the expression in the data
> > cell is this (it is a matrix cell)
> >
> > =IIF(IsNothing(Fields!PERCENT.Value), "No Data",
> > Sum(Fields!PERCENT.Value)/100 )
> >
> > and the expression for the background color to be set for this cell is
> > this:
> >
> > =IIF(IsNothing(Fields!PERCENT.Value), "white", code.SetColor(
> > Fields!PerformanceValue.Value))
> >
> > and the Function is this:
> >
> > Public Function SetColor(ByVal N As Double) As String
> >
> > Select N
> > Case 0
> > Return "Salmon"
> > Case 1
> > Return "PaleGoldenrod"
> > Case 2
> > Return "LightGreen"
> > Case 3
> > Return "RoyalBlue"
> > Case Else
> > Return "Transparent"
> >
> > End Select
> >
> > End Function
> >
> > I tried changing the function to return values "#90EE90" etc and I altered
> > the IIF statement to read "#FFFFFF" instead of "white" ... but that didnt
> > work - it rendered correctly except didnt export to excel and show green
> > ...
> > it still showed grey. I did get a warning message "The background color
> > expression used in textbox 'textbox8' returned a data type that is not
> > valid"
> > - textbox 8 is the cell I am using. I know when I have used hex codes for
> > colors in the past ... I dont believe I enclosed them in quotes in the
> > cell,
> > but I cant return #90EE90 from my function without putting quotes around
> > it,
> > can I? What would you do next?
> >
> >
> > "Kaisa M. Lindahl Lervik" wrote:
> >
> >> Try using Hexadecimal colour codes, like #c0ffc0 (quite light green) or
> >> #80ff80.
> >>
> >> Case 0
> >> Return "#80ff80"
> >>
> >> I would have used hex codes for all colours that are not plain red,
> >> yellow,
> >> blue and green, just to be sure it was rendered OK.
> >>
> >> Kaisa M. Lindahl Lervik
> >>
> >>
> >> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> >> news:592E3ADE-1BCD-4729-8782-61B6ACC1A275@.microsoft.com...
> >> >I have a report that needs to have a green cell (based on a condition of
> >> > course - which is decided in a code function) Here is my function:
> >> >
> >> > Public Function SetColor(ByVal N As Double) As String
> >> >
> >> > Select N
> >> > Case 0
> >> > Return "Salmon"
> >> > Case 1
> >> > Return "PaleGoldenrod"
> >> > Case 2
> >> > Return "LightGreen"
> >> > Case 3
> >> > Return "RoyalBlue"
> >> > Case Else
> >> > Return "Transparent"
> >> >
> >> > End Select
> >> >
> >> > End Function
> >> >
> >> > All of the colors work *except* LightGreen. I can even *see* Light
> >> > Green
> >> > in the excel color palette (notice the "space" in the excel color name)
> >> > ... I
> >> > dont even *see* Salmon, Palegoldenrod or anything else there ... and
> >> > yet
> >> > *those* show properly. It is only the green color that shows wrong and
> >> > it
> >> > displays as GREY. Not good. I have tried other light green colors but
> >> > the
> >> > only GREEN I can get to work is GREEN and that is too dark. Can
> >> > someone
> >> > help
> >> > with this? TIA ...
> >> >
> >> >
> >>
> >>
> >>
>
>

No comments:

Post a Comment