How can I right justify columns in Powershell's Out-GridView?

I'm using the following parts of a script to display information sourced from XML & SQL Server
$properties = @{
	BoxNumber = $line.box
	PartNumber = $line.part
	SalesOrder = $line.so
	QtyPacked = "{0,10:N2}" -f [double]$line.qty
	OrderLine = [int]$DR.GetValue(0)
	Customer = $DR.GetValue(1)
	Ordered = "{0,10:N2}" -f [double]$DR.GetValue(2)
	Delivered = "{0,10:N2}" -f [double]$DR.GetValue(3)
	Picked = "{0,10:N2}" -f [double]$DR.GetValue(4)
	Invoiced = "{0,10:N2}" -f [double]$DR.GetValue(5)
}
$pnLines += New-Object -TypeName PSObject -Property $properties
.
.
.
$pnLines | select -Property SalesOrder, OrderLIne, PartNumber, QtyPacked, Ordered, Picked, Delivered, Invoiced, BoxNumber, Customer | sort SalesOrder, OrderLine | Out-GridView -Wait -Title $title

Open in new window

The numbers in the columns QtyPacked, Ordered, Picked, Delivered & Invoiced have moved towards the right hand side, but they're more centred than right-aligned:
Column appearanceI'm sure I must have missed something obvious, but I just can't see it.
Any ideas would be much appreciated.
LVL 1
SysWarTechSysAdminAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Guess you will have bad luck with properly adjusting. Your formatting creates a formatted string, using spaces, and Out-GridView displays spaces in a proportional font, which is not monotyped / typewriter, and hence has different width for space and digits. But without formatting all numbers are aligned left - even worse.
From the (online) help:
The command output that you send to Out-GridView cannot be formatted, such as by using the Format-Table or Format-Wide cmdlets. To select properties, use the Select-Object cmdlet.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
The best result with manually formatting I had is by replacing two spaces with three
e={ '{0,10:N2}' -f $_.Length -replace '  ', '   '}

Open in new window

but it is still just a "patch" not fitting very well.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SysWarTechSysAdminAuthor Commented:
Not a bad work around.
Useful to know that my approach wasn't going to work (no matter how many times I hit my head on the desk!)

I had a similar idea after you mentioned that the formatting is just added spaces.
I tried replacing spaces with en-spaces -
$ensp = [char]0x2002
and changing the Select-Object properties to -
@{Label = "Qty Packed"; exp= { $_.QtyPacked.Replace(" ", $ensp) } }, etc.
It doesn't look too bad.

Thanks again for your help
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.