I need a bit of help from any of the coders out there.....
Currently, the code Reads which a CSV file and then outputs it to a html file using Powershell. And I have to use Powershell as there are other bits to this code(not shown here) which uses Powershell.
How do you colour a row on a table depending on a value of a cell?
Current bit of code look as below.
$datagridView1.DataSource | Export-Csv c:\tmp\test.csv
#HTML OUTPUT
$head= @"
<style>
BODY{background-color:white;}
TABLE{border-width: 3px;border-style: solid; border-color:white;border-collapse:
collapse;}
TH{border-width: 3px;padding: 2px;border-style: solid;border-color: white;background- color:yellow}
</style>
<script type="text/javascript">
var allText =[];
var allTextLines = [];
var Lines = [];
var txtFile = new XMLHttpRequest();
txtFile.open("GET", "file://c:/tmp/test.csv", true);
txtFile.onreadystatechange = function()
{
allText = txtFile.responseText;
allTextLines = allText.split(/\r\n|\n/);
};
document.write(allTextLines);<br>
document.write(allText);<br>
document.write(txtFile);<br>
</script>
"@
$datagridView1.DataSource | convertto-html -head $head –body "<H2>Query</H2>" | Out-File C:\tmp\app.html
The app.html file also seems to be creating the following four columns which are not in the CSV file (RowError, RowState, Table, ItemArray, HasErrors) and I can't figure out where its coming from.
Any help would be greatly appreciated