我当前的代码只对齐Excel工作表的前5行:
$xlCenter=-4108
$excel = New-Object -Com Excel.Application
$excel.Visible = $True
$excel.Rows.Item("1:5").HorizontalAlignment = $xlCenter
但是没有人知道我的程序将从数据库中读取多少行。如何居中对齐所有行?
答案 0 :(得分:3)
不要将您应用格式的行限制为:
"Name","Address","FullPhone"
"Mike Wise","101 Abc Drive","4061234567" // Need to separate area code from the rest