# Concerning ConvertTo-Html

**URL:** <https://forums.powershell.org/t/concerning-convertto-html/7256>\
**Category:** PowerShell Help\
**Created:** [September 24, 2016, 5:34am UTC](https://forums.powershell.org/t/concerning-convertto-html/7256 "2016-09-24T05:34:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [September 24, 2016, 5:34am UTC](https://forums.powershell.org/t/concerning-convertto-html/7256/1 "2016-09-24T05:34:46Z")

</div>

Hello Community 😉

I’m trying to format an output of the script and came across the ConvertTo-HTML cmdlet.

This is my code.

```
$a01 = "abc"
$a02 = "def"
-join ($a01, $a02)
-join ($a02, $a01)
```

I need to get the HTML table like this as an output of the script.

```
---------------
| abc | def |
----------------
| def | abc |
-------------
```

Is that possible?

---

<div class="post-metadata">

**Author:** ![daniel-krebs](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/daniel-krebs/32/484_2.png) [@daniel-krebs](https://forums.powershell.org/u/daniel-krebs)\
**Post date:** [September 24, 2016, 6:13am UTC](https://forums.powershell.org/t/concerning-convertto-html/7256/2 "2016-09-24T06:13:56Z")

</div>

The ConvertTo-Html cmdlet works best with custom objects.

Example:

```
$a01 = "abc"
$a02 = "def"

@(
    [PSCustomObject]@{
        Column1 = $a01
        Column2 = $a02
    }
    [PSCustomObject]@{
        Column1 = $a02
        Column2 = $a01
    }
) | ConvertTo-Html -Fragment
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [September 24, 2016, 8:46am UTC](https://forums.powershell.org/t/concerning-convertto-html/7256/3 "2016-09-24T08:46:30Z")

</div>

Thanks, Daniel!

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:40pm UTC](https://forums.powershell.org/t/concerning-convertto-html/7256/4 "2024-05-16T20:40:18Z")

</div>

Closed on May 16, 2024, 8:40pm UTC


