Cmdlet
Add-OfficePdfTable
Adds a table to a PDF document.
Syntax
Add-OfficePdfTable [-Align <Left|Center|Right|Justify>] [-AutoFitColumns] [-BorderColor <String>] [-BorderWidth <Double>] [-Caption <String>] [-CaptionAlign <Left|Center|Right|Justify>] [-CaptionColor <String>] [-CaptionFontSize <Double>] [-CellPaddingX <Double>] [-CellPaddingY <Double>] [-CollectionSeparator <String>] [-ColumnAlign <Left|Center|Right>] [-ColumnWidthPoints <Double[]>] [-ColumnWidthWeights <Double[]>] [-DictionaryEntrySeparator <String>] [-DictionaryKeyValueSeparator <String>] [-FontSize <Double>] [-FooterRowCount <Int32>] [-Header <String[]>] [-HeaderFill <String>] [-HeaderFontSize <Double>] [-HeaderRowCount <Int32>] [-HeaderTextColor <String>] [-InputObject] <Object> [-KeepTogether] [-KeepWithNext] [-LineHeight <Double>] [-MaxCollectionItems <Int32>] [-MaxNestingDepth <Int32>] [-MinimumShrinkFontSize <Double>] [-NoBorder] [-NoHeaderFill] [-NoRowStripeFill] [-PassThru] [-Property <String[]>] [-RepeatHeaderRowCount <Int32>] [-RightAlignNumeric] [-RowStripeFill <String>] [-ShrinkTextToFit] [-SpacingAfter <Double>] [-SpacingBefore <Double>] [-TableStyle <String>] [-TextColor <String>] [-View <Normal|Transpose>] [<CommonParameters>]#Parameter set:
ContextAdd-OfficePdfTable [-Align <Left|Center|Right|Justify>] [-AutoFitColumns] [-BorderColor <String>] [-BorderWidth <Double>] [-Caption <String>] [-CaptionAlign <Left|Center|Right|Justify>] [-CaptionColor <String>] [-CaptionFontSize <Double>] [-CellPaddingX <Double>] [-CellPaddingY <Double>] [-CollectionSeparator <String>] [-ColumnAlign <Left|Center|Right>] [-ColumnWidthPoints <Double[]>] [-ColumnWidthWeights <Double[]>] [-DictionaryEntrySeparator <String>] [-DictionaryKeyValueSeparator <String>] -Document <PdfDocument> [-FontSize <Double>] [-FooterRowCount <Int32>] [-Header <String[]>] [-HeaderFill <String>] [-HeaderFontSize <Double>] [-HeaderRowCount <Int32>] [-HeaderTextColor <String>] [-InputObject] <Object> [-KeepTogether] [-KeepWithNext] [-LineHeight <Double>] [-MaxCollectionItems <Int32>] [-MaxNestingDepth <Int32>] [-MinimumShrinkFontSize <Double>] [-NoBorder] [-NoHeaderFill] [-NoRowStripeFill] [-PassThru] [-Property <String[]>] [-RepeatHeaderRowCount <Int32>] [-RightAlignNumeric] [-RowStripeFill <String>] [-ShrinkTextToFit] [-SpacingAfter <Double>] [-SpacingBefore <Double>] [-TableStyle <String>] [-TextColor <String>] [-View <Normal|Transpose>] [<CommonParameters>]#Parameter set:
DocumentAdd-OfficePdfTable [-Align <Left|Center|Right|Justify>] [-AutoFitColumns] [-BorderColor <String>] [-BorderWidth <Double>] [-Caption <String>] [-CaptionAlign <Left|Center|Right|Justify>] [-CaptionColor <String>] [-CaptionFontSize <Double>] [-CellPaddingX <Double>] [-CellPaddingY <Double>] [-CollectionSeparator <String>] [-ColumnAlign <Left|Center|Right>] [-ColumnWidthPoints <Double[]>] [-ColumnWidthWeights <Double[]>] [-DictionaryEntrySeparator <String>] [-DictionaryKeyValueSeparator <String>] -Document <PdfDocument> [-FontSize <Double>] [-FooterRowCount <Int32>] [-Header <String[]>] [-HeaderFill <String>] [-HeaderFontSize <Double>] [-HeaderRowCount <Int32>] [-HeaderTextColor <String>] [-InputObject] <Object> [-KeepTogether] [-KeepWithNext] [-LineHeight <Double>] [-MaxCollectionItems <Int32>] [-MaxNestingDepth <Int32>] [-MinimumShrinkFontSize <Double>] [-NoBorder] [-NoHeaderFill] [-NoRowStripeFill] [-PassThru] [-Property <String[]>] [-RepeatHeaderRowCount <Int32>] [-RightAlignNumeric] [-RowStripeFill <String>] [-ShrinkTextToFit] [-SpacingAfter <Double>] [-SpacingBefore <Double>] [-TableStyle <String>] [-TextColor <String>] [-View <Normal|Transpose>] [<CommonParameters>]#Parameter set:
PipelineDocumentExamples
Add object data as a PDF table.
$services = @(
[pscustomobject]@{ Name = 'Directory'; Status = 'Healthy'; Incidents = 0 }
[pscustomobject]@{ Name = 'Mail'; Status = 'Watch'; Incidents = 2 }
)
New-OfficePdf -Path .\Examples\Documents\PdfTable.pdf {
Add-OfficePdfHeading -Text 'Service status'
Add-OfficePdfTable -InputObject $services -Property Name,Status,Incidents -Header 'Service','Status','Incidents'
}Converts PowerShell objects into a table using selected properties and friendly headers.
Parameters
- -Align PdfAlign
- Table alignment.
- Possible values:
Left,Center,Right,Justify - -AutoFitColumns SwitchParameter
- Measure flexible columns from content.
- -BorderColor String
- Border color. Named colors and hexadecimal values are accepted.
- -BorderWidth Double
- Border width in PDF points.
- -Caption String
- Caption rendered above the table grid.
- -CaptionAlign PdfAlign
- Caption alignment.
- Possible values:
Left,Center,Right,Justify - -CaptionColor String
- Caption color. Named colors and hexadecimal values are accepted.
- -CaptionFontSize Double
- Caption font size in PDF points.
- -CellPaddingX Double
- Horizontal cell padding in PDF points.
- -CellPaddingY Double
- Vertical cell padding in PDF points.
- -CollectionSeparator String
- Text used between items when a property or cell contains a collection.
- -ColumnAlign PdfColumnAlign[]
- Per-column horizontal alignment.
- Possible values:
Left,Center,Right - -ColumnWidthPoints Double[]
- Fixed column widths in PDF points.
- -ColumnWidthWeights Double[]
- Relative column width weights.
- -DictionaryEntrySeparator String
- Text used between entries when a cell contains a dictionary.
- -DictionaryKeyValueSeparator String
- Text used between a dictionary key and value.
- -FontSize Double
- Body cell font size in PDF points.
- Number of trailing rows rendered as footer rows.
- -Header String[]
- Header labels. Defaults to property names.
- -HeaderFill String
- Header fill color. Named colors and hexadecimal values are accepted.
- -HeaderFontSize Double
- Header cell font size in PDF points.
- -HeaderRowCount Int32
- Number of leading rows rendered as header rows.
- -HeaderTextColor String
- Header text color. Named colors and hexadecimal values are accepted.
- -InputObject Object
- Objects or row arrays to render as a table.
- -KeepTogether SwitchParameter
- Keep the table together when possible.
- -KeepWithNext SwitchParameter
- Keep the table with the next block when possible.
- -LineHeight Double
- Wrapped line height multiplier for table cells.
- -MaxCollectionItems Int32
- Maximum number of items allowed in one nested collection or dictionary cell. Defaults to 1,048,575; increase explicitly for trusted larger values.
- -MaxNestingDepth Int32
- Maximum nesting depth allowed while normalizing one cell value. Defaults to 64; increase explicitly for trusted deeper values.
- -MinimumShrinkFontSize Double
- Smallest font size, in points, used by -ShrinkTextToFit.
- -NoBorder SwitchParameter
- Hide table borders.
- -NoHeaderFill SwitchParameter
- Disable the header fill.
- -NoRowStripeFill SwitchParameter
- Disable alternating row fill.
- -PassThru SwitchParameter
- Emit the updated document.
- -Property String[]
- Specific object properties to include.
- -RepeatHeaderRowCount Int32
- Number of leading header rows repeated on following pages.
- -RightAlignNumeric SwitchParameter
- Right-align numeric-looking cell values.
- -RowStripeFill String
- Alternating body row fill color. Named colors and hexadecimal values are accepted.
- -ShrinkTextToFit SwitchParameter
- Reduce table text size when needed so cell text fits within the resolved cell width.
- -SpacingAfter Double
- Spacing after the table in PDF points.
- -SpacingBefore Double
- Spacing before the table in PDF points.
- -TableStyle String
- OfficeIMO table style preset or supported Word table style name.
- -TextColor String
- Body text color. Named colors and hexadecimal values are accepted.
- -View OfficeTableView
- Projection to apply before writing the table.
- Possible values:
Normal,Transpose - -Document PdfDocument
- PDF document to update outside the DSL context.
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.