Skip to content

Calculated properties passed to ConvertTo-Html do not support the "n" / "name" key #6994

@mklement0

Description

@mklement0

Note: This is merely an inconsistency with other cmdlets that support calculated properties, such as Select-Object, where n / name and l / label can be used interchangeably to name a property.

ConvertTo-Html only supports l / label.

Steps to reproduce

'one' | Select-Object @{ n='Name'; e={ $_ } }
'one' | ConvertTo-Html -Property @{ n='Name'; e={ $_ } }

Expected behavior

Name
----
one

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML TABLE</title>
</head><body>
<table>
<colgroup><col/></colgroup>
<tr><th>Name</th></tr>
<tr><td>one</td></tr>
</table>
</body></html>

Actual behavior


Name
----
one

ConvertTo-Html : The n key is not valid.

Environment data

PowerShell Core v6.1.0-preview.2 on macOS 10.13.4
PowerShell Core v6.1.0-preview.2 on Ubuntu 16.04.4 LTS
PowerShell Core v6.1.0-preview.2 on Microsoft Windows 10 Pro (64-bit; Version 1709, OS Build: 16299.371)
Windows PowerShell v5.1.17134.48 on Microsoft Windows 10 Pro (64-bit; Version 1709, OS Build: 16299.371)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions