Can I do this better?

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 2 years, 6 months ago.

  • Author
    Posts
  • #15581
    Profile photo of Tony Wainwright
    Tony Wainwright
    Participant

    Hi,

    Back again 're-purposing' (or as I like to call it 'screwing it up for my own purposes') another script in my quest for learning and world domination.

    In essence I have a css style assigned to $Style for use with ConvertTo-HTML. The script goes away and collects some info which it puts into an variable called $Var. A separate variable called $Table is created and the following create a $Body variable which is used to as body text for an email.
    $Body = $Var | Select $Table | ConvertTo-HTML -head $Style

    What I want to do is add some text above the table and format with the predefined $Style.
    I have tried this:
    $BodyTable = $ItaniumUpdates | Select $Table | ConvertTo-HTML -head $Style
    $Body = "Some text here." + $BodyTable

    but this doesn't format the "Some text here." according to style

    How do I add the text to the email before the table and still format it?
    Thanks
    Tony

  • #15582
    Profile photo of Tony Wainwright
    Tony Wainwright
    Participant

    Yes, use the -body parameter
    $Body = $Var | Select $Table | ConvertTo-HTML -head $Style -boby"Some text here."
    Love it that I've answered my own question!!!

  • #15586
    Profile photo of Don Jones
    Don Jones
    Keymaster

    If you wrap your text in an HTML element, like a div, you can apply a class to it and then format that class in your css.

You must be logged in to reply to this topic.