API Reference
Cmdlet
Invoke-OfficeExcelTemplateOptionalRow
Includes or removes an optional Excel template row block.
Remarks
Includes or removes an optional Excel template row block.
Examples
Keep an optional discount row and bind markers in it.
PS>
Invoke-OfficeExcelTemplateOptionalRow -Path .\Invoice.xlsx -Sheet Invoice -FirstRow 10 -Value @{ Discount = '10%' }
Leaves the optional row block in place, replaces its markers, and saves the workbook.
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.
Syntax
Invoke-OfficeExcelTemplateOptionalRow [-CultureName <String>] -FirstRow <Int32> [-MissingValueBehavior <Nullable`1>] [-PassThru] [-Remove] [-RowCount <Int32>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ThrowOnMissing] [-Value <Hashtable>] [<CommonParameters>]#Parameter set:
ContextParameters
- CultureName String
- Culture name used for built-in marker format aliases such as currency and date.
- FirstRow Int32
- 1-based first row in the optional block.
- MissingValueBehavior Nullable`1
- Behavior used when a marker in the optional block is not supplied by -Value.
- PassThru SwitchParameter
- Returns the number of marker replacements.
- Remove SwitchParameter
- Removes the optional row block instead of keeping and binding it.
- RowCount Int32
- Number of rows in the optional block.
- Sheet String
- Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- Worksheet index when using a workbook object or path.
- ThrowOnMissing SwitchParameter
- Throws when a marker in the optional block is not supplied by -Value.
- Value Hashtable
- Template marker values used when the optional row block is included.
Outputs
System.Int32
Invoke-OfficeExcelTemplateOptionalRow [-CultureName <String>] -FirstRow <Int32> -InputPath <String> [-MissingValueBehavior <Nullable`1>] [-PassThru] [-Remove] [-RowCount <Int32>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ThrowOnMissing] [-Value <Hashtable>] [<CommonParameters>]#Parameter set:
PathParameters
- CultureName String
- Culture name used for built-in marker format aliases such as currency and date.
- FirstRow Int32
- 1-based first row in the optional block.
- InputPath String
- Workbook path to update.
- MissingValueBehavior Nullable`1
- Behavior used when a marker in the optional block is not supplied by -Value.
- PassThru SwitchParameter
- Returns the number of marker replacements.
- Remove SwitchParameter
- Removes the optional row block instead of keeping and binding it.
- RowCount Int32
- Number of rows in the optional block.
- Sheet String
- Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- Worksheet index when using a workbook object or path.
- ThrowOnMissing SwitchParameter
- Throws when a marker in the optional block is not supplied by -Value.
- Value Hashtable
- Template marker values used when the optional row block is included.
Outputs
System.Int32
Invoke-OfficeExcelTemplateOptionalRow [-CultureName <String>] -Document <ExcelDocument> -FirstRow <Int32> [-MissingValueBehavior <Nullable`1>] [-PassThru] [-Remove] [-RowCount <Int32>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ThrowOnMissing] [-Value <Hashtable>] [<CommonParameters>]#Parameter set:
DocumentParameters
- CultureName String
- Culture name used for built-in marker format aliases such as currency and date.
- Document ExcelDocument
- Workbook to update outside the DSL context.
- FirstRow Int32
- 1-based first row in the optional block.
- MissingValueBehavior Nullable`1
- Behavior used when a marker in the optional block is not supplied by -Value.
- PassThru SwitchParameter
- Returns the number of marker replacements.
- Remove SwitchParameter
- Removes the optional row block instead of keeping and binding it.
- RowCount Int32
- Number of rows in the optional block.
- Sheet String
- Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- Worksheet index when using a workbook object or path.
- ThrowOnMissing SwitchParameter
- Throws when a marker in the optional block is not supplied by -Value.
- Value Hashtable
- Template marker values used when the optional row block is included.
Outputs
System.Int32