# Please help with Out-GridView formatting

**URL:** <https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276>\
**Category:** PowerShell Help\
**Created:** [December 11, 2023, 11:16am UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276 "2023-12-11T11:16:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![drew](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@drew](https://forums.powershell.org/u/drew)\
**Post date:** [December 11, 2023, 11:16am UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/1 "2023-12-11T11:16:50Z")

</div>

Hello everybody!  
Can somebody explain: is there any way to overcome such a constraint.  
Since one of the string properties of an object represents a multi-line string that is more than 9 lines, the Out-GridView cmdlet outputs only first 9 lines of that property followed by three dots.  
This can be easily checked via such a trivial script:

```auto
$arr = @()
$arr = 
for ($i = 1; $i -le 25; $i++) {
    $val = for ($j = 1; $j -le $i; $j++) {$j}
    $val = $val -join "`n"
    New-Object -TypeName:PSObject -Property:@{Val=$val}
}

$arr | Out-GridView

```

Is there any way to make the Out-GridView output all the lines independently of there amount?  
Thanks in advance for any answer!!!

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [December 11, 2023, 11:46pm UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/2 "2023-12-11T23:46:05Z")

</div>

I dont have an answer for your specific question. I think Out-Gridview is what it is. You could however do something with Windows forms ?? I played around with google and came up with this. Might be worth playing with. If you drag the column wider, you can see all your numbers.

```auto
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

$form = New-Object System.Windows.Forms.Form
$form.Size = New-Object System.Drawing.Size(900,600)
$list = New-Object System.collections.ArrayList

$arr = for ($i = 1; $i -le 25; $i++) {
    $val = for ($j = 1; $j -le $i; $j++) {$j}
    $val = $val -join "`n"
    New-Object -TypeName:PSObject -Property:@{Val=$val}
}

$list.AddRange($arr)

$dataGridView = New-Object System.Windows.Forms.DataGridView -Property @{
    Size = New-Object System.Drawing.Size(800,400)
    ColumnHeadersVisible = $true
    DataSource = $list
}

$form.Controls.Add($dataGridView)
$form.ShowDialog()

```

---

<div class="post-metadata">

**Author:** ![drew](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@drew](https://forums.powershell.org/u/drew)\
**Post date:** [December 12, 2023, 4:30am UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/3 "2023-12-12T04:30:16Z")

</div>

Thanks for answering!  
Yeah… WindowsForms will certainly help but it’s not convenient to script with windows forms for one-time tasks (for each one))) while piping to Out-GridView is.  
I’ve thought the deal is with formatting and something like \*.Format.ps1xml but as it appears it’s unfortunately not((( Seems like the point is direct in the Out-GridView’s code itself

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [December 12, 2023, 7:32am UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/4 "2023-12-12T07:32:42Z")

</div>

> [@drew](#):
>
> WindowsForms will certainly help but it’s not convenient to script with windows forms for one-time tasks (for each one))) while piping to Out-GridView is.

There might be a better way. 😉 Would you like to explain what you’re actually want to do? … the whole thing … not the way you think you should go to achieve what you want. ☝🏼

**EDIT:**

> [@drew](#):
>
> an object represents a multi-line string that is more than 9 lines

Depending on the “level” of “multi-line-ness” you may try the PowerShell 7 module " [ConsoleGuiTools](https://github.com/PowerShell/GraphicalTools)" (GraphicalTools). There you have the cmdlet `Out-ConsoleGridView`. This is able to show the sample array from your question at least until the 19th line.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/6/6f17d3559c23120e8f8df06f4414ca40ed6b4dd9.png)

---

<div class="post-metadata">

**Author:** ![drew](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@drew](https://forums.powershell.org/u/drew)\
**Post date:** [December 12, 2023, 8:29am UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/5 "2023-12-12T08:29:38Z")

</div>

I’ve explained in the question at the top of the topic: I want to find a way (if exists) to make Out-GridView to output ALL the lines of a multi-line string, not only the first 9. Run my script, mentioned in the question and pay attention to the 9-th and 10-th lines of the Out-GridView output (and further). Notice the difference.  
I don’t need to solve a particular (specific) task by any way. 99,99% of my tasks I solve myself in different kinds of way without any help. I don’t want to script a just-now task or code a C# app for it when I can solve it by one-line command with a number of pipelines where the last command is Out-GridView to analyze data in a convenient way. But sometimes, when it’s really matters, I have to additionally save my results in some variable to check the multi-line value in console because Out-GridView cuts off all the lines far than 9-th. It is very similar to that how different Format-\* cmdlets do. So I’ve thought some formatting rules may help but seems to be not((( For now it appears to me that the only way to get what I want is to edit the de-compiled code of Out-GridView and recompile it for my use))) But of-course it’s a such a perversion)))  
Just thought anybody knows some more sane way…  
For " [ConsoleGuiTools](https://github.com/PowerShell/GraphicalTools)" – my thanks!!! But we still “sitting” on the framework and PS 5.1 (shame on us))))  
Never the less thanks a lot!

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [December 12, 2023, 6:26pm UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/6 "2023-12-12T18:26:30Z")

</div>

I found this interesting. Nice of M$ to provide the source.

> <https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs>

---

<div class="post-metadata">

**Author:** ![drew](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@drew](https://forums.powershell.org/u/drew)\
**Post date:** [December 13, 2023, 5:00pm UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/7 "2023-12-13T17:00:48Z")

</div>

> [@tonyd](#):
>
> I found this interesting. Nice of M$ to provide the source.

Wow!!! It’s really, really, really cool!!! Thank you very very much!!! Began to think to de-compile an assembly containing Out-GridView but your godsend is really awesome! Indeed “Nice of M$ to provide the source”)))

---

<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:13pm UTC](https://forums.powershell.org/t/please-help-with-out-gridview-formatting/23276/8 "2024-05-16T20:13:38Z")

</div>

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


