I'm building a script that will create an html report containing a table with multiple values in each Column Row (e.g. given cell may have 1 or more values). I'm building my output variable like this (assume there is a bunch of script before that is going to put data into all those variables):
I'm going to return the data generated here as part of a function call
$dlphashtable=[Ordered]@{
Exchange = ($exchangemembers | Out-String).Trim()
OneDriveUsers = ($onedrivemembers | Out-String).Trim()
OneDriveGroups = ($onedrivesites | Out-String).Trim()
SharePoint = ($sharepointlocations | Out-String).Trim()
Teams = ($teamslocations | Out-String).Trim()
Endpoints = ($endpointdlplocations | Out-String).Trim()
DefenderforCA = ($defenderforCAlocations | Out-String).Trim()
OnPremDLP = ($onpremlocations | Out-String).Trim()
}
$dlppolicydetailobject = [PSCustomObject]$dlphashtable
return $dlppolicydetailobject
If I output this data to a csv, grid-view, or to the screen, each one of the items shows up on a new line as i want it to (and i'd expect). Grid View Output Image Excel Output Image
However if I convert the file to HTML then the table formats the text based on the width of the browser. View of converto-html output
How can I make the output so that each of the values in the HTML table show up on a new line in their appropriate column?