Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Add-OfficePdfTable

Aliases: PdfTable
Module
PSWriteOffice
Aliases
PdfTable
Inputs
OfficeIMO.Pdf.PdfDocument System.Object
Outputs
OfficeIMO.Pdf.PdfDocument

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: Context
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>]
-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: Document
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>]
-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: PipelineDocument

Examples

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 optional
Table alignment.
Possible values: Left, Center, Right, Justify
-AutoFitColumns SwitchParameter optional
Measure flexible columns from content.
-BorderColor String optional
Border color. Named colors and hexadecimal values are accepted.
-BorderWidth Double optional
Border width in PDF points.
-Caption String optional
Caption rendered above the table grid.
-CaptionAlign PdfAlign optional
Caption alignment.
Possible values: Left, Center, Right, Justify
-CaptionColor String optional
Caption color. Named colors and hexadecimal values are accepted.
-CaptionFontSize Double optional
Caption font size in PDF points.
-CellPaddingX Double optional
Horizontal cell padding in PDF points.
-CellPaddingY Double optional
Vertical cell padding in PDF points.
-CollectionSeparator String optional
Text used between items when a property or cell contains a collection.
-ColumnAlign PdfColumnAlign[] optional
Per-column horizontal alignment.
Possible values: Left, Center, Right
-ColumnWidthPoints Double[] optional
Fixed column widths in PDF points.
-ColumnWidthWeights Double[] optional
Relative column width weights.
-DictionaryEntrySeparator String optional
Text used between entries when a cell contains a dictionary.
-DictionaryKeyValueSeparator String optional
Text used between a dictionary key and value.
-FontSize Double optional
Body cell font size in PDF points.
-FooterRowCount Int32 optional
Number of trailing rows rendered as footer rows.
-Header String[] optional
Header labels. Defaults to property names.
-HeaderFill String optional
Header fill color. Named colors and hexadecimal values are accepted.
-HeaderFontSize Double optional
Header cell font size in PDF points.
-HeaderRowCount Int32 optional
Number of leading rows rendered as header rows.
-HeaderTextColor String optional
Header text color. Named colors and hexadecimal values are accepted.
-InputObject Object requiredposition: 0pipeline: True (ByValue)
Objects or row arrays to render as a table.
-KeepTogether SwitchParameter optional
Keep the table together when possible.
-KeepWithNext SwitchParameter optional
Keep the table with the next block when possible.
-LineHeight Double optional
Wrapped line height multiplier for table cells.
-MaxCollectionItems Int32 optional
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 optional
Maximum nesting depth allowed while normalizing one cell value. Defaults to 64; increase explicitly for trusted deeper values.
-MinimumShrinkFontSize Double optional
Smallest font size, in points, used by -ShrinkTextToFit.
-NoBorder SwitchParameter optional
Hide table borders.
-NoHeaderFill SwitchParameter optional
Disable the header fill.
-NoRowStripeFill SwitchParameter optional
Disable alternating row fill.
-PassThru SwitchParameter optional
Emit the updated document.
-Property String[] optional
Specific object properties to include.
-RepeatHeaderRowCount Int32 optional
Number of leading header rows repeated on following pages.
-RightAlignNumeric SwitchParameter optional
Right-align numeric-looking cell values.
-RowStripeFill String optional
Alternating body row fill color. Named colors and hexadecimal values are accepted.
-ShrinkTextToFit SwitchParameter optional
Reduce table text size when needed so cell text fits within the resolved cell width.
-SpacingAfter Double optional
Spacing after the table in PDF points.
-SpacingBefore Double optional
Spacing before the table in PDF points.
-TableStyle String optional
OfficeIMO table style preset or supported Word table style name.
-TextColor String optional
Body text color. Named colors and hexadecimal values are accepted.
-View OfficeTableView optional
Projection to apply before writing the table.
Possible values: Normal, Transpose
-Document PdfDocument requiredpipeline: True (ByValue)sets: Document, PipelineDocument
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.