none
Multiple headers with CSS in 'ConvertTo-Html' RRS feed

  • Question

  • Dear experts,

    thanks for commenting on my previous threads and helping me with that. Here I am faced with another issue and since I am not super HTML nerd, I was seeking some help. The question is simple. How should I have multiple headers when I send an output to 'ConvertTo-Html'? Here is a summary of the script:

    ##### Define Header #####
    $Header            = @"
    <style>
        BODY 
        { 
            font-family:Tahoma ;
            font-size:12px;
        }
        TABLE 
        { 
            border-width: 1px; 
            border-style: solid; 
            text-align:center; 
            border-collapse: separate;
            border-spacing: 2px;
            -webkit-border-horizontal-spacing: 2px;
            -webkit-border-vertical-spacing: 2px;
            border-color: #999999;
        }
        TH 
        {
            border-width: 1px; 
            padding: 3px; 
            border-style: solid; 
            border-color: #999999;
            text-align:center;
            background-color:#00cc66;
            color:white
        }
        TD 
        {
            border-width: 1px; 
            padding: 3px; 
            border-style: solid; 
            border-color: #999999;
            text-align:center;
        }
    </style>
    "@
    
    
    ##### Main Script #####
    .....
    bla
    bla
    bla
    .....
    
    
    
    ##### Output #####
    $Results | ConvertTo-Html -Property DC,Site -Head $Header
    
    

    It is ok and the report is created in HTML in proper format. I just need to add another HEADER above the first header so that I can present some information like 'Report Time:' , ...

    Do I have to create a second TR {} but place it inside the main TABLE {} and use the same $Header or I am not in the right direction?

    Thanks


    Mahdi Tehrani | | www.mahditehrani.ir
    Make sure to download my free PowerShell scripts:

    • Moved by Bill_Stewart Wednesday, September 4, 2019 6:17 PM This is not "teach me HTML/CSS" forum
    Friday, March 1, 2019 4:36 PM

All replies