mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-20 02:03:29 +00:00
Merge pull request #228 from jeremytbrun/TitleFix
Title fix (Issues #182 and #89)
This commit is contained in:
@@ -41,7 +41,7 @@ Function Export-Excel {
|
||||
'#,##0.00'
|
||||
|
||||
# number with 2 decimal places and thousand separator and money symbol
|
||||
'<EFBFBD>#,##0.00'
|
||||
'€#,##0.00'
|
||||
|
||||
# percentage (1 = 100%, 0.01 = 1%)
|
||||
'0%'
|
||||
@@ -498,8 +498,14 @@ Function Export-Excel {
|
||||
}
|
||||
}
|
||||
|
||||
$startAddress=$ws.Dimension.Start.Address
|
||||
$dataRange="{0}:{1}" -f $startAddress, $ws.Dimension.End.Address
|
||||
if ($Title) {
|
||||
$startAddress = "A2"
|
||||
}
|
||||
else {
|
||||
$startAddress = $ws.Dimension.Start.Address
|
||||
}
|
||||
|
||||
$dataRange = "{0}:{1}" -f $startAddress, $ws.Dimension.End.Address
|
||||
|
||||
Write-Debug "Data Range '$dataRange'"
|
||||
|
||||
@@ -509,6 +515,9 @@ Function Export-Excel {
|
||||
|
||||
if (-not [String]::IsNullOrEmpty($TableName)) {
|
||||
$csr = $StartRow
|
||||
if ($Title) {
|
||||
$csr += 1
|
||||
}
|
||||
$csc = $StartColumn
|
||||
$cer = $ws.Dimension.End.Row
|
||||
$cec = $script:Header.Count
|
||||
@@ -526,10 +535,6 @@ Function Export-Excel {
|
||||
|
||||
$pivotTableDataName=$WorkSheetname + 'PivotTableData'
|
||||
|
||||
if ($Title) {
|
||||
$startAddress = 'A2'
|
||||
}
|
||||
|
||||
$pivotTable = $wsPivot.PivotTables.Add($wsPivot.Cells['A1'], $ws.Cells[$dataRange], $pivotTableDataName)
|
||||
|
||||
if ($PivotRows) {
|
||||
@@ -607,7 +612,13 @@ Function Export-Excel {
|
||||
}
|
||||
}
|
||||
if ($BoldTopRow) {
|
||||
$range=$ws.Dimension.Address -replace $ws.Dimension.Rows, '1'
|
||||
if ($Title) {
|
||||
$range = $ws.Dimension.Address -replace '\d+', '2'
|
||||
}
|
||||
else {
|
||||
$range = $ws.Dimension.Address -replace '\d+', '1'
|
||||
}
|
||||
|
||||
$ws.Cells[$range].Style.Font.Bold = $true
|
||||
}
|
||||
if ($AutoSize) {
|
||||
@@ -687,7 +698,7 @@ Function Export-Excel {
|
||||
$rule.Style.Font.Color.Color = $targetConditionalText.ConditionalTextColor
|
||||
$rule.Style.Fill.PatternType = $targetConditionalText.PatternType
|
||||
$rule.Style.Fill.BackgroundColor.Color = $targetConditionalText.BackgroundColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($CellStyleSB) {
|
||||
|
||||
@@ -27,6 +27,11 @@ iex (new-object System.Net.WebClient).DownloadString('https://raw.github.com/dfi
|
||||
```
|
||||
|
||||
# What's new
|
||||
#### 10/2/2017
|
||||
Fixed issues related to use of -Title parameter combined with column formatting parameters.
|
||||
- [Issue #182](https://github.com/dfinke/ImportExcel/issues/182)
|
||||
- [Issue #89](https://github.com/dfinke/ImportExcel/issues/89)
|
||||
|
||||
#### 9/28/2017 (Version 4.0.1)
|
||||
- Added a new parameter called `Password` to import password protected files
|
||||
- Added even more `Pester` tests for a more robust and bug free module
|
||||
|
||||
Reference in New Issue
Block a user