iainbrighton/PScribo

Feature Request: Support for multiple columns in List tables

Closed this issue · 3 comments

It would be great if List tables had support for multiple columns to be able to present data as per below.

DC 1 DC 2
Hostname DC1SYS1 DC2SYS1
IP Address 192.168.1.10 192.168.1.11
Subnet Mask 255.255.255.0 255.255.255.0

@tpcarman I have been working on this to see what's logical - without breaking existing functionality. So far I have this:

param (
    [System.String[]] $Format = 'Html',
    [System.String] $Path = '~\Desktop',
    [System.Management.Automation.SwitchParameter] $PassThru
)

Import-Module PScribo -Force;

$example33 = Document -Name 'PScribo Example 33' {

    Style -Name Normal -Size 11 -Color 000 -Font 'Segoe UI','Helvetica','Arial','sans-serif'
    Style -Name GithubTableHeading -Size 12 -Bold 
    Style -Name GithubTableRow -Size 12
    Style -Name GithubTableAltRow -Size 12 -BackgroundColor f6f8fa
    TableStyle GithubTable -BorderWidth 1 -BorderColor dfe2e5 -HeaderStyle GithubTableHeading -RowStyle GithubTableRow -AlternateRowStyle GithubTableAltRow -PaddingTop 5 -PaddingLeft 10 -PaddingBottom 5 -PaddingRight 10

    $exampleObjects = @(
        [PSCustomObject] @{ Name = 'DC1'; Hostname = 'DC1SYS1'; 'IP Address' = '192.168.1.10'; 'Subnet Mask' = '255.255.255.0'; }
        [PSCustomObject] @{ Name = 'DC2'; Hostname = 'DC2SYS1'; 'IP Address' = '192.168.1.11'; 'Subnet Mask' = '255.255.255.0'; }
    )

    Table -InputObject $exampleObjects -Style GithubTable -List -Combine 'Name' -Width 0
}
$example33 | Export-Document -Path $Path -Format $Format -PassThru:$PassThru

I only have HTML output working and it (currently) renders like this:

image

Does this a) work for you and b) can you think of an alternative to -Combine '<property>'?

@tpcarman This functionality is now available in the dev branch. Can you take it for a spin and let me know whether you see any issues? Thanks, Iain

Available in the 0.8.0 release