Public/Export.ps1

<#
.SYNOPSIS
    Exports a PowerShell object to an HTML report.
.DESCRIPTION
    This function takes a PowerShell object and exports it to a styled HTML report.
.PARAMETER InputObject
    The PowerShell object to export.
.PARAMETER Path
    The path to save the HTML report to.
.EXAMPLE
    Get-O365SecurityScorecard | Export-O365ReportToHtml -Path "C:\temp\SecurityScorecard.html"
.NOTES
    This function can be used to export the output of any other function in the toolkit to a professional-looking HTML report.
#>

function Export-O365ReportToHtml {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true, ValueFromPipeline=$true)]
        $InputObject,
        [Parameter(Mandatory=$true)]
        [string]$Path
    )

    $Css = @"
    <style>
        body { font-family: Arial, sans-serif; }
        table { border-collapse: collapse; width: 100%; }
        th, td { border: 1px solid #dddddd; text-align: left; padding: 8px; }
        th { background-color: #f2f2f2; }
        tr:nth-child(even) { background-color: #f9f9f9; }
    </style>
"@


    $InputObject | ConvertTo-Html -Head $Css | Out-File -FilePath $Path
    Write-Verbose "Report saved to $Path"
}