Import-Excel 7.8.9 - Export Excel file with AutoSize function
bovirus opened this issue · 3 comments
bovirus commented
My scope is to create an Execl file as table with columns autozize 8adapt column size to larger data vailable)
If I use a funcion like
Export-Excel -Path ExcelFile.xlsx -TableName Table1 -AutoSize"
I create a file ExcelFile.xlsx and openiong it I can check that the coumn size is not set automatically because if I sue in execl columns autozie the column are larger,.
What's the matter?
dfinke commented
need to see the data, script and what OS you are working on
bovirus commented
dfinke commented
which columns have the issue?
-AutoSize is best guess. When the xlsx is opened, the cells are rendered and the font can result in the column widths being off.
$xlpkg = $data | Export-Excel test.xlsx -AutoSize -PassThru
Set-ExcelRange -Worksheet $xlpkg.Sheet1 -Range "C:C" -Width 22
Set-ExcelRange -Worksheet $xlpkg.Sheet1 -Range "E:E" -Width 32
Close-ExcelPackage $xlpkg -Show