Closed schittli closed 7 years ago
@schittli If you're only interested in HTML output then you should be able to do this:
Import-Module -Name PScribo
$GPOInfo = [PSCustomObject] @{
DisplayName = 'Example GPO';
Description = "This description`r`nincludes a line break";
}
Document HtmlTableLinkBreaks {
$GPOInfo | % {
Section "GPOs $($_.DisplayName)" -Style Heading2 -ScriptBlock {
$GPODetail = [Ordered] @{
Name = $_.DisplayName
## Replace all line breaks with a HTML line break
Description = ($_.Description -replace "`r`n","<br />")
}
New-Object -TypeName PSObject -Property $GPODetail | Table -List
}
}
}
Obviously, if you were to try this with Text or Word output, then it wouldn't work 😞.
Hi @iainbrighton
Thank you very much for your fast answer and the complete example!, we really just use HTML output and therefore, your code works great.
And it's good to know that we can use HTML-Tags like <br />.
We will avoid it, but sometimes they can be lifesavers :-)
Thanks a lot, kind regards, Tom
Good evening Thank you very much for this really wonderful PowerShell-Module!, it's really great to see how you embedded the Document formatting into the PowerShell Syntax.
I have a small problem and was not able to find a solution: I would like to print a table with a Title and a Description which is a string which contains newlines, e.g.:
PScribo renders ith this way:
I tried to split the Description into a string[], but the Parser is not able to handle it:
Does someone knows a solution how to replace Newlines by Linebreaks?
Thanks a lot for any help in advance, kind regards, Tom