Cmdlet
Invoke-OfficeExcelTemplateOptionalRow
Includes or removes an optional Excel template row block.
Syntax
Invoke-OfficeExcelTemplateOptionalRow [-CultureName <String>] -FirstRow <Int32> [-MissingValueBehavior <PreserveMarker|EmptyString|Throw>] [-PassThru] [-Remove] [-RowCount <Int32>] [-Sheet <String>] [-SheetIndex <Int32>] [-ThrowOnMissing] [-Value <Hashtable>] [<CommonParameters>]#Parameter set:
ContextInvoke-OfficeExcelTemplateOptionalRow [-CultureName <String>] -FirstRow <Int32> [-MissingValueBehavior <PreserveMarker|EmptyString|Throw>] [-PassThru] [-Path] <String> [-Remove] [-RowCount <Int32>] [-Sheet <String>] [-SheetIndex <Int32>] [-ThrowOnMissing] [-Value <Hashtable>] [<CommonParameters>]#Parameter set:
PathInvoke-OfficeExcelTemplateOptionalRow [-CultureName <String>] -Document <ExcelDocument> -FirstRow <Int32> [-MissingValueBehavior <PreserveMarker|EmptyString|Throw>] [-PassThru] [-Remove] [-RowCount <Int32>] [-Sheet <String>] [-SheetIndex <Int32>] [-ThrowOnMissing] [-Value <Hashtable>] [<CommonParameters>]#Parameter set:
DocumentExamples
Keep an optional discount row and bind markers in it.
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.
Parameters
- -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 ExcelTemplateMissingValueBehavior
- Behavior used when a marker in the optional block is not supplied by -Value.
- Possible values:
PreserveMarker,EmptyString,Throw - -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 Int32
- 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.
- -Path String
- Workbook path to update.
- -Document ExcelDocument
- Workbook 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.