mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-15 07:43:23 +00:00
Format datetime properties
This commit is contained in:
@@ -176,15 +176,20 @@ function Export-Excel {
|
|||||||
$ColumnIndex = 1
|
$ColumnIndex = 1
|
||||||
|
|
||||||
foreach ($Name in $Header) {
|
foreach ($Name in $Header) {
|
||||||
$ws.Cells[$Row, $ColumnIndex].Value = $TargetData.$Name
|
|
||||||
|
$targetCell = $ws.Cells[$Row, $ColumnIndex]
|
||||||
|
$targetCell.Value = $TargetData.$Name
|
||||||
|
|
||||||
|
switch ($TargetData.$Name) {
|
||||||
|
{$_ -is [datetime]} {$targetCell.Style.Numberformat.Format = "m/d/yy h:mm"}
|
||||||
|
}
|
||||||
|
|
||||||
$ColumnIndex += 1
|
$ColumnIndex += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
End {
|
End {
|
||||||
|
|
||||||
if($AutoSize) {$ws.Cells.AutoFitColumns()}
|
|
||||||
|
|
||||||
if($IncludePivotTable) {
|
if($IncludePivotTable) {
|
||||||
$pivotTableName = $WorkSheetname + "PivotTable"
|
$pivotTableName = $WorkSheetname + "PivotTable"
|
||||||
$wsPivot = $pkg.Workbook.Worksheets.Add($pivotTableName)
|
$wsPivot = $pkg.Workbook.Worksheets.Add($pivotTableName)
|
||||||
@@ -223,6 +228,7 @@ function Export-Excel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($AutoSize) { $ws.Cells.AutoFitColumns() }
|
||||||
if($Password) { $ws.Protection.SetPassword($Password) }
|
if($Password) { $ws.Protection.SetPassword($Password) }
|
||||||
|
|
||||||
$pkg.Save()
|
$pkg.Save()
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ This PowerShell Module wraps the .NET EPPlus DLL (included). Easily integrate re
|
|||||||
|
|
||||||
Know Issues
|
Know Issues
|
||||||
-
|
-
|
||||||
* You don't know what you don't know
|
* You don't know what you don't know
|
||||||
|
|
||||||
What's new
|
What's new
|
||||||
-
|
-
|
||||||
|
|
||||||
|
#### 4/27/2015
|
||||||
|
* datetime properties were displaying as ints, now are formatted
|
||||||
|
|
||||||
#### 4/25/2015
|
#### 4/25/2015
|
||||||
* Now you can create multiple Pivot tables in one pass
|
* Now you can create multiple Pivot tables in one pass
|
||||||
* Thanks to [pscookiemonster](https://twitter.com/pscookiemonster), he submitted a repro case to the EPPlus CodePlex project and got it fixed
|
* Thanks to [pscookiemonster](https://twitter.com/pscookiemonster), he submitted a repro case to the EPPlus CodePlex project and got it fixed
|
||||||
|
|||||||
Reference in New Issue
Block a user