Files
ImportExcel/Public/Enable-ExcelAutofit.ps1
2022-04-28 19:44:49 -04:00

16 lines
372 B
PowerShell

function Enable-ExcelAutofit {
<#
.SYNOPSIS
Make all text fit the cells
.EXAMPLE
Enable-ExcelAutofit $excel.Sheet1
#>
param(
[Parameter(Mandatory)]
[OfficeOpenXml.ExcelWorksheet]$Worksheet
)
$range = Get-ExcelSheetDimensionAddress $Worksheet
$Worksheet.Cells[$range].AutoFitColumns()
}