Skip to content

ConvertTo-Html incorrectly labels default single column #2185

@TimCurwick

Description

@TimCurwick

Previously documented on UserVoice https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11522970-convertto-html-incorrectly-labels-default-single-c

When the -Property parameter is not used (and it thereby defaults to match string '*') or when a match string is used with the -Property parameter, and the result is only a single property, ConvertTo-Html uses the match string as the column header instead of the property name.

Steps to reproduce

$X = [pscustomobject]@{ Name = 'Joe' } 
ConvertTo-Html -InputObject $X -Fragment
''
$X = [pscustomobject]@{ Name = 'Joe'; ID = 27 } 
ConvertTo-Html -InputObject $X -Property N* -Fragment

Expected behavior

Name
Joe
Name
Joe

Actual behavior

*
Joe
N*
Joe

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.9-248-g2b3f79345f83c42a1b45cfd860dc364d33300883
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

> $PSVersionTable
Name                           Value                                                                                                                                                                 
----                           -----                                                                                                                                                                 
PSVersion                      5.1.14393.103                                                                                                                                                         
PSEdition                      Desktop                                                                                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                               
BuildVersion                   10.0.14393.103                                                                                                                                                        
CLRVersion                     4.0.30319.42000                                                                                                                                                       
WSManStackVersion              3.0                                                                                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                                                                                   
SerializationVersion           1.1.0.1 

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdletsgeneral cmdlet issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions