# New-OfficeExcelPdfOptions

Creates discoverable Excel-to-PDF conversion options for Convert-OfficeDocument -To Pdf.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`None`

**Outputs**

`OfficeIMO.Excel.Pdf.ExcelPdfExportOptions`

**Source**

[NewOfficeExcelPdfOptionsCommand.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/3b680b1b6fb15a268ff5525a4ca6cdd70b2f6613/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/NewOfficeExcelPdfOptionsCommand.cs#L27) 

Creates discoverable Excel-to-PDF conversion options for Convert-OfficeDocument -To Pdf.

## Syntax

```
New-OfficeExcelPdfOptions
[-AllowDocumentFontEmbedding]
[-AllowSystemFontEmbedding]
[-ChartFidelity <Strict|BestEffort>]
[-ChartLayout <OfficeChartLayout>]
[-ChartStyle <OfficeChartStyle>]
[-EmptyCellText <String>]
[-Font <String>]
[-HeaderRowCount <Int32>]
[-IncludeSheetHeadings]
[-MarginBottom <OfficeLength>]
[-MarginLeft <OfficeLength>]
[-MarginRight <OfficeLength>]
[-MarginTop <OfficeLength>]
[-MaxRowsPerSheet <Int32>]
[-PageSize <PdfPageSize>]
[-PdfOptions <PdfCreateOptions>]
[-RespectWorkbookSheetVisibility]
[-RespectWorksheetHiddenRowsAndColumns]
[-Sheet <OfficeSheetSelector[]>]
[-UseBoundedWorksheetRead]
[-UseWorksheetCellStyles]
[-UseWorksheetCharts]
[-UseWorksheetColumnWidths]
[-UseWorksheetHeaderFooterImages]
[-UseWorksheetHeadersAndFooters]
[-UseWorksheetHyperlinks]
[-UseWorksheetImages]
[-UseWorksheetMergedCells]
[-UseWorksheetPageBreaks]
[-UseWorksheetPageSetup]
[-UseWorksheetPrintAreas]
[-UseWorksheetPrintTitleRows]
[-UseWorksheetRowHeights]
[-WorksheetLayout <WorksheetCanvas|FlowTable>]
[<CommonParameters>]
```

[#](#member-395570f7d013c2ab1d1bc62a)

Parameter set: `Default`

## Examples

### Convert chosen sheets to PDF

```powershell
$pdf = New-OfficeExcelPdfOptions -Sheet Summary, Orders -UseWorksheetPrintAreas
Convert-OfficeDocument -Path .\Reports\Q3-Sales.xlsx -OutputPath .\Reports\Q3-Sales.pdf -Options $pdf
```

Converts only the Summary and Orders sheets, honouring the print areas set in the workbook.

### Convert a folder of reports with page setup

```powershell
$pdf = New-OfficeExcelPdfOptions -PageSize A4 -MarginLeft 1.5cm -MarginRight 1.5cm -UseWorksheetPageSetup -UseWorksheetHeadersAndFooters -UseWorksheetPrintTitleRows -RespectWorkbookSheetVisibility
Get-ChildItem -Path .\Reports -Filter *.xlsx |
    Convert-OfficeDocument -To Pdf -OutputDirectory .\Pdf -Options $pdf
```

Converts every workbook in the folder to A4 PDFs that use each sheet's page setup, headers and repeated titles.

## Parameters

**-AllowDocumentFontEmbedding SwitchParameter optional**

Allow embedding installed fonts selected by a trusted workbook. System-font embedding must also be enabled.

**-AllowSystemFontEmbedding SwitchParameter optional**

Allow embedding fonts discovered on the current system.

**-ChartFidelity OfficeChartFidelity optional**

Chart handling: Strict (default) skips charts with formatting that cannot be drawn exactly; BestEffort draws the closest approximation and reports chart-approximation warnings.

Possible values: `Strict`, `BestEffort`

**-ChartLayout OfficeChartLayout optional**

Chart layout override.

**-ChartStyle OfficeChartStyle optional**

Chart visual style override.

**-EmptyCellText String optional**

Text used when a worksheet cell is empty.

**-Font String optional**

Default font family used when the workbook does not specify one.

**-HeaderRowCount Int32 optional**

Number of leading rows treated as headers.

**-IncludeSheetHeadings SwitchParameter optional**

Include worksheet row and column headings.

**-MarginBottom OfficeLength optional**

Bottom page margin in PDF points.

**-MarginLeft OfficeLength optional**

Left page margin in PDF points.

**-MarginRight OfficeLength optional**

Right page margin in PDF points.

**-MarginTop OfficeLength optional**

Top page margin in PDF points.

**-MaxRowsPerSheet Int32 optional**

Maximum worksheet rows to read and render.

**-PageSize PdfPageSize optional**

PDF page size.

**-PdfOptions PdfCreateOptions optional**

Underlying low-level OfficeIMO PDF options.

**-RespectWorkbookSheetVisibility SwitchParameter optional**

Exclude workbook sheets marked hidden.

**-RespectWorksheetHiddenRowsAndColumns SwitchParameter optional**

Exclude hidden worksheet rows and columns.

**-Sheet OfficeSheetSelector[] optional**

Worksheet names, wildcard patterns or one-based positions. Live worksheet inputs are captured by name for reusable saved conversions.

**-UseBoundedWorksheetRead SwitchParameter optional**

Use bounded worksheet reads for large workbooks.

**-UseWorksheetCellStyles SwitchParameter optional**

Render worksheet cell styles.

**-UseWorksheetCharts SwitchParameter optional**

Render worksheet charts.

**-UseWorksheetColumnWidths SwitchParameter optional**

Honor worksheet column widths.

**-UseWorksheetHeaderFooterImages SwitchParameter optional**

Render images referenced by worksheet headers and footers.

**-UseWorksheetHeadersAndFooters SwitchParameter optional**

Render worksheet headers and footers.

**-UseWorksheetHyperlinks SwitchParameter optional**

Render worksheet hyperlinks.

**-UseWorksheetImages SwitchParameter optional**

Render worksheet images.

**-UseWorksheetMergedCells SwitchParameter optional**

Render merged worksheet cells.

**-UseWorksheetPageBreaks SwitchParameter optional**

Honor worksheet page breaks.

**-UseWorksheetPageSetup SwitchParameter optional**

Honor worksheet page setup.

**-UseWorksheetPrintAreas SwitchParameter optional**

Honor worksheet print areas.

**-UseWorksheetPrintTitleRows SwitchParameter optional**

Honor worksheet rows configured to repeat on printed pages.

**-UseWorksheetRowHeights SwitchParameter optional**

Honor worksheet row heights.

**-WorksheetLayout ExcelPdfWorksheetLayoutMode optional**

Controls how worksheet content is laid out on PDF pages.

Possible values: `WorksheetCanvas`, `FlowTable`

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:99C159F6433AC5F8F347C764EEDC4111662558F28BE00F16DBF2587DB21F6E56 -->
