forked from dfinke/ImportExcel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNew-ConditionalText.ps1
More file actions
42 lines (40 loc) · 1.83 KB
/
Copy pathNew-ConditionalText.ps1
File metadata and controls
42 lines (40 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function New-ConditionalText {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '',Justification='Does not change system State')]
param(
#[Parameter(Mandatory=$true)]
[Alias('ConditionValue')]
$Text,
[Alias('ForeGroundColor')]
$ConditionalTextColor=[System.Drawing.Color]::DarkRed,
$BackgroundColor=[System.Drawing.Color]::LightPink,
[String]$Range,
[OfficeOpenXml.Style.ExcelFillStyle]$PatternType=[OfficeOpenXml.Style.ExcelFillStyle]::Solid,
[ValidateSet(
'LessThan', 'LessThanOrEqual', 'GreaterThan', 'GreaterThanOrEqual',
'Equal', 'NotEqual',
'Top', 'TopPercent', 'Bottom', 'BottomPercent',
'ContainsText', 'NotContainsText', 'BeginsWith', 'EndsWith',
'ContainsBlanks', 'NotContainsBlanks', 'ContainsErrors', 'NotContainsErrors',
'DuplicateValues', 'UniqueValues',
'Tomorrow', 'Today', 'Yesterday', 'Last7Days',
'NextWeek', 'ThisWeek', 'LastWeek',
'NextMonth', 'ThisMonth', 'LastMonth',
'AboveAverage', 'AboveOrEqualAverage', 'BelowAverage', 'BelowOrEqualAverage',
'Expression'
)]
[Alias('RuleType')]
$ConditionalType='ContainsText'
)
$obj = [PSCustomObject]@{
Text = $Text
ConditionalTextColor = $ConditionalTextColor
ConditionalType = $ConditionalType
PatternType = $PatternType
Range = $Range
BackgroundColor = $BackgroundColor
}
$obj.pstypenames.Clear()
$obj.pstypenames.Add("ConditionalText")
$obj
}