We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Use powershell to fit all excel columns to one PDF page

We are using old dll 17.10. Does anyone know how to fit all columns in Excel to one page using powershell?

This is what we had.

$newName = $csvFileItem.FullName.Replace(".xlsx", “.pdf”)
$doc = New-Object Aspose.Cells.Workbook -ArgumentList $csvFileItem.FullName
$saveOptions = New-Object Aspose.Cells.PdfSaveOptions
$doc.Save($newName, [Aspose.Cells.FileFormatType]::Pdf)

Thanks in advance.


Thanks for your query.

You can use AllColumnsInOnePagePerSheet property of PdfSaveOptions class and set it to true in order to fit all columns to one page of PDF.

saveOptions.AllColumnsInOnePagePerSheet = true;

Let us know your feedback.