iainbrighton / PScribo

PowerShell documentation framework
MIT License
231 stars 35 forks source link

[Question]How can I center a text in a header of table? #47

Closed it-praktyk closed 7 years ago

it-praktyk commented 7 years ago

I would like center a text in a table header.

The currently my table looks like below summary_table

The best answer for me (#lazymodeon) will be based on the code https://github.com/it-praktyk/Format-Pester/blob/devel/Format-Pester/Public/Format-Pester.ps1#L342-L373 .

Thank you.

iainbrighton commented 7 years ago

Hi @it-praktyk , you should be able to override the table header style. If you want to override the defaults. The defaults are set here when the document is initialised. You should be able to do this:

Document TableHeadingExample {

    ## Example table
    $summaryTable = [Ordered] @{
        'Total Tests' = 43;
        'Passed Tests' = 14;
        'Failed Tests' = 11;
    }

    ## Override the built-in styles so they are centered
    Style -Name TableDefaultHeading -Size 11 -Color fff -Bold -BackgroundColor 4472c4 -Align Center
    Style -Name TableDefaultRow -Size 11 -Align Center

    Table -Hashtable $summaryTable

} | Export-Document -Format Html -PassThru | Invoke-Item

Hopefully that helps?!

it-praktyk commented 7 years ago

Thank you.