Add multidimensional array to html table in Powershell -


i have 2d array $dates 2 columns , multiple rows example:

$dates[0][0] = 2016.07.20 $dates[0][1] = 1 $dates[1][0] = 2016.08.19 $dates[1][1] = 6 ... 

i need add array html output table. example have style of html table:

$a = "<style>" $a = $a + "table{border-width: 2px;border-style: solid;border-color: black;border-collapse: collapse;}" $a = $a + "td{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}" $a = $a + "</style>" 

when use:

$dates | select @{expression={$_}}| convertto-html -head $a | out-file "c:\test.htm" 

i output, in same column:

<tr><td>2016.07.20 1</td></tr> <tr><td>2016.08.19 6</td></tr> <tr><td>2016.08.20 6</td></tr> 

i need have values in different columns:

<tr><td>2016.07.20</td><td>1</td></tr> <tr><td>2016.08.19</td><td>6</td></tr> <tr><td>2016.08.20</td><td>6</td></tr> 

unfortunately unable find examples how fix that. please can help? how can add values in different columns?

concatenate array manually:

'<tr>' + (     ($dates | %{         '<td>' + ($_ -join '</td><td>') + '</td>'     }) -join "</tr>`n<tr>" ) + '</tr>' 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -