This topic is locked

export a $value with color

5/14/2018 6:57:25 PM
PHPRunner General questions
M
Mark Kramer author

Hello,
I have a total value that when I export it to excel it puts "code" as the value instead of just the number ($value). I just want the numeric value not he code. It works perfect on screen but when I export it gives me the code.
Here is the code I use under the field custom:



if ($value >79) {

$color="green";

} else {

$color="red";

}

$value="<font color='$color'>$value</font>";

Here is what is exported in that field after it exports to excel:
<font color='green'>95</font>
I don't necessarily need the color in excel, just the number.
Any help would be great thanks!

DealerModulesDevClub member 5/14/2018

[quote name='Mark Kramer' date='14 May 2018 - 05:57 PM' timestamp='1526338645' post='85046']

Hello,
I have a total value that when I export it to excel it puts "code" as the value instead of just the number ($value). I just want the numeric value not he code. It works perfect on screen but when I export it gives me the code.
Here is the code I use under the field custom:



if ($value >79) {

$color="green";

} else {

$color="red";

}

$value="<font color='$color'>$value</font>";

Hi Mark,
Try replacing your last line:

$value="<font color='$color'>$value</font>";[/i]
with this and recompile

$value="<span style='color: " . $color . "'>" .$value . "</span>";[/i]
Thanks

Paul

M
Mark Kramer author 5/15/2018

[quote name='Dealer Modules' date='14 May 2018 - 07:40 PM' timestamp='1526344802' post='85047']
I tried your suggestion too and it gave me the same results on the export to excel. It works great on the screen but it does not on the export..
Thanks for the suggestion just the same.