Supports auto detect for Hyperlink

This commit is contained in:
dfinke
2015-12-20 16:37:14 -05:00
parent 08c4cd54f3
commit 4ea7f5d05b

View File

@@ -170,6 +170,21 @@ function Export-Excel {
switch ($TargetData.$Name) {
{$_ -is [datetime]} {$targetCell.Style.Numberformat.Format = "m/d/yy h:mm"}
}
[ref]$uriResult=$null
if ([uri]::TryCreate($cellValue, [System.UriKind]::Absolute, $uriResult)) {
$targetCell.Hyperlink = [uri]$cellValue
$namedStyle=$ws.Workbook.Styles.NamedStyles | where {$_.Name -eq 'HyperLink'}
if(!$namedStyle) {
$namedStyle=$ws.Workbook.Styles.CreateNamedStyle("HyperLink")
$namedStyle.Style.Font.UnderLine = $true
$namedStyle.Style.Font.Color.SetColor("Blue")
}
$targetCell.StyleName = "HyperLink"
}
$ColumnIndex += 1
}