mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Renamed LegendPostion to LegendPosition
This commit is contained in:
@@ -21,6 +21,6 @@ Add-PivotTable -Address $excel.Sheet1.Cells["F1"] -SourceWorkSheet $Excel.Sheet1
|
|||||||
ChartType="ColumnClustered";
|
ChartType="ColumnClustered";
|
||||||
Column=11; Width=500; Height=360;
|
Column=11; Width=500; Height=360;
|
||||||
YMajorUnit=500; YMinorUnit=100; YAxisNumberformat="$#,##0"
|
YMajorUnit=500; YMinorUnit=100; YAxisNumberformat="$#,##0"
|
||||||
LegendPostion="Bottom"}
|
LegendPosition="Bottom"}
|
||||||
#Save and open in excel
|
#Save and open in excel
|
||||||
Close-ExcelPackage $excel -Show
|
Close-ExcelPackage $excel -Show
|
||||||
@@ -33,7 +33,7 @@ function New-ExcelChartDefinition {
|
|||||||
If specified, turns of display of the key. If you only have one data series it may be preferable to use the title to say what the chart is.
|
If specified, turns of display of the key. If you only have one data series it may be preferable to use the title to say what the chart is.
|
||||||
.PARAMETER SeriesHeader
|
.PARAMETER SeriesHeader
|
||||||
Specify explicit name(s) for the data series, which will appear in the legend/key
|
Specify explicit name(s) for the data series, which will appear in the legend/key
|
||||||
.PARAMETER LegendPostion
|
.PARAMETER LegendPosition
|
||||||
Location of the key, either left, right, top, bottom or TopRight.
|
Location of the key, either left, right, top, bottom or TopRight.
|
||||||
.PARAMETER LegendSize
|
.PARAMETER LegendSize
|
||||||
Font size for the key
|
Font size for the key
|
||||||
@@ -86,7 +86,7 @@ function New-ExcelChartDefinition {
|
|||||||
PS> $cDef = New-ExcelChartDefinition -ChartType line -XRange "X" -YRange "Sinx" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
PS> $cDef = New-ExcelChartDefinition -ChartType line -XRange "X" -YRange "Sinx" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
||||||
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
||||||
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
||||||
-SeriesHeader "Sin(x)" -LegendSize 8 -legendBold -LegendPostion Bottom
|
-SeriesHeader "Sin(x)" -LegendSize 8 -legendBold -LegendPosition Bottom
|
||||||
|
|
||||||
0..360 | ForEach-Object {[pscustomobject][ordered]@{x = $_; Sinx = "=Sin(Radians(x)) "}} | Export-Excel -AutoNameRange -now -WorkSheetname SinX -ExcelChartDefinition $cDef -Show
|
0..360 | ForEach-Object {[pscustomobject][ordered]@{x = $_; Sinx = "=Sin(Radians(x)) "}} | Export-Excel -AutoNameRange -now -WorkSheetname SinX -ExcelChartDefinition $cDef -Show
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ function New-ExcelChartDefinition {
|
|||||||
$RowOffSetPixels = 10,
|
$RowOffSetPixels = 10,
|
||||||
$Column = 6,
|
$Column = 6,
|
||||||
$ColumnOffSetPixels = 5,
|
$ColumnOffSetPixels = 5,
|
||||||
[OfficeOpenXml.Drawing.Chart.eLegendPosition]$LegendPostion,
|
[OfficeOpenXml.Drawing.Chart.eLegendPosition]$LegendPosition,
|
||||||
$LegendSize,
|
$LegendSize,
|
||||||
[Switch]$LegendBold,
|
[Switch]$LegendBold,
|
||||||
[Switch]$NoLegend,
|
[Switch]$NoLegend,
|
||||||
@@ -147,7 +147,7 @@ function New-ExcelChartDefinition {
|
|||||||
RowOffSetPixels = $RowOffSetPixels
|
RowOffSetPixels = $RowOffSetPixels
|
||||||
Column = $Column
|
Column = $Column
|
||||||
ColumnOffSetPixels = $ColumnOffSetPixels
|
ColumnOffSetPixels = $ColumnOffSetPixels
|
||||||
LegendPostion = $LegendPostion
|
LegendPosition = $LegendPosition
|
||||||
LegendSize = $LegendSize
|
LegendSize = $LegendSize
|
||||||
Legendbold = $LegendBold
|
Legendbold = $LegendBold
|
||||||
NoLegend = $NoLegend -as [Boolean]
|
NoLegend = $NoLegend -as [Boolean]
|
||||||
@@ -217,7 +217,7 @@ function Add-ExcelChart {
|
|||||||
If specified, turns of display of the key. If you only have one data series it may be preferable to use the title to say what the chart is.
|
If specified, turns of display of the key. If you only have one data series it may be preferable to use the title to say what the chart is.
|
||||||
.PARAMETER SeriesHeader
|
.PARAMETER SeriesHeader
|
||||||
Specify explicit name(s) for the data series, which will appear in the legend/key
|
Specify explicit name(s) for the data series, which will appear in the legend/key
|
||||||
.PARAMETER LegendPostion
|
.PARAMETER LegendPosition
|
||||||
Location of the key, either left, right, top, bottom or TopRight.
|
Location of the key, either left, right, top, bottom or TopRight.
|
||||||
.PARAMETER LegendSize
|
.PARAMETER LegendSize
|
||||||
Font size for the key
|
Font size for the key
|
||||||
@@ -307,7 +307,7 @@ function Add-ExcelChart {
|
|||||||
Add-ExcelChart -Worksheet $excel.Workbook.Worksheets["Sinx"] -ChartType line -XRange "X" -YRange "Sinx" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
Add-ExcelChart -Worksheet $excel.Workbook.Worksheets["Sinx"] -ChartType line -XRange "X" -YRange "Sinx" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
||||||
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
||||||
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
||||||
-SeriesHeader "Sin(x)" -LegendSize 8 -legendBold -LegendPostion Bottom
|
-SeriesHeader "Sin(x)" -LegendSize 8 -legendBold -LegendPosition Bottom
|
||||||
Close-ExcelPackage $Excel -Show
|
Close-ExcelPackage $Excel -Show
|
||||||
|
|
||||||
The first line puts numbers from 0 to 360 into a sheet, as the first column, and a formula to calculate the Sine of that number of number of degrees in the second column.
|
The first line puts numbers from 0 to 360 into a sheet, as the first column, and a formula to calculate the Sine of that number of number of degrees in the second column.
|
||||||
@@ -336,7 +336,7 @@ function Add-ExcelChart {
|
|||||||
[int]$RowOffSetPixels = 10,
|
[int]$RowOffSetPixels = 10,
|
||||||
[int]$Column = 6,
|
[int]$Column = 6,
|
||||||
[int]$ColumnOffSetPixels = 5,
|
[int]$ColumnOffSetPixels = 5,
|
||||||
[OfficeOpenXml.Drawing.Chart.eLegendPosition]$LegendPostion,
|
[OfficeOpenXml.Drawing.Chart.eLegendPosition]$LegendPosition,
|
||||||
$LegendSize,
|
$LegendSize,
|
||||||
[Switch]$LegendBold,
|
[Switch]$LegendBold,
|
||||||
[Switch]$NoLegend,
|
[Switch]$NoLegend,
|
||||||
@@ -394,7 +394,7 @@ function Add-ExcelChart {
|
|||||||
}
|
}
|
||||||
if ($NoLegend) { $chart.Legend.Remove() }
|
if ($NoLegend) { $chart.Legend.Remove() }
|
||||||
else {
|
else {
|
||||||
if ($LegendPostion) {$Chart.Legend.Position = $LegendPostion}
|
if ($LegendPosition) {$Chart.Legend.Position = $LegendPosition}
|
||||||
if ($LegendSize) {$chart.Legend.Font.Size = $LegendSize}
|
if ($LegendSize) {$chart.Legend.Font.Size = $LegendSize}
|
||||||
if ($legendBold) {$chart.Legend.Font.Bold = $true}
|
if ($legendBold) {$chart.Legend.Font.Bold = $true}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
.Example
|
.Example
|
||||||
>
|
>
|
||||||
PS> $chartdef = New-ExcelChartDefinition -Title "Gross and net by city and product" -ChartType ColumnClustered `
|
PS> $chartdef = New-ExcelChartDefinition -Title "Gross and net by city and product" -ChartType ColumnClustered `
|
||||||
-Column 11 -Width 500 -Height 360 -YMajorUnit 500 -YMinorUnit 100 -YAxisNumberformat "$#,##0" -LegendPostion Bottom
|
-Column 11 -Width 500 -Height 360 -YMajorUnit 500 -YMinorUnit 100 -YAxisNumberformat "$#,##0" -LegendPosition Bottom
|
||||||
|
|
||||||
$excel = ConvertFrom-Csv @"
|
$excel = ConvertFrom-Csv @"
|
||||||
Product, City, Gross, Net
|
Product, City, Gross, Net
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ Describe ExportExcel {
|
|||||||
Add-ExcelChart -Worksheet $excel.Workbook.Worksheets["Sinx"] -ChartType line -XRange "X" -YRange "Sinx" -SeriesHeader "Sin(x)" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
Add-ExcelChart -Worksheet $excel.Workbook.Worksheets["Sinx"] -ChartType line -XRange "X" -YRange "Sinx" -SeriesHeader "Sin(x)" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
||||||
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
||||||
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
||||||
-LegendSize 8 -legendBold -LegendPostion Bottom
|
-LegendSize 8 -legendBold -LegendPosition Bottom
|
||||||
Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets["Sinx"] -Range "B2:B362" -RuleType LessThan -ConditionValue "=B1" -ForeGroundColor Red
|
Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets["Sinx"] -Range "B2:B362" -RuleType LessThan -ConditionValue "=B1" -ForeGroundColor Red
|
||||||
$ws = $Excel.Workbook.Worksheets["Sinx"]
|
$ws = $Excel.Workbook.Worksheets["Sinx"]
|
||||||
$d = $ws.Drawings[0]
|
$d = $ws.Drawings[0]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Banana, Paris, 300, 200
|
|||||||
Apple, New York, 1200,700
|
Apple, New York, 1200,700
|
||||||
"@ | Export-Excel -Path $path -TableStyle Medium13 -tablename "RawData" -ConditionalFormat @{Range="C2:C7"; DataBarColor="Green"} -ExcelChartDefinition @{ChartType="Doughnut";XRange="A2:B7"; YRange="C2:C7"; width=800; } -PivotTableDefinition @{Sales=@{
|
"@ | Export-Excel -Path $path -TableStyle Medium13 -tablename "RawData" -ConditionalFormat @{Range="C2:C7"; DataBarColor="Green"} -ExcelChartDefinition @{ChartType="Doughnut";XRange="A2:B7"; YRange="C2:C7"; width=800; } -PivotTableDefinition @{Sales=@{
|
||||||
PivotRows="City"; PivotColumns="Product"; PivotData=@{Gross="Sum";Net="Sum"}; PivotNumberFormat="$#,##0.00"; PivotTotals="Both"; PivotTableSyle="Medium12"; Activate=$true
|
PivotRows="City"; PivotColumns="Product"; PivotData=@{Gross="Sum";Net="Sum"}; PivotNumberFormat="$#,##0.00"; PivotTotals="Both"; PivotTableSyle="Medium12"; Activate=$true
|
||||||
PivotChartDefinition=@{Title="Gross and net by city and product"; ChartType="ColumnClustered"; Column=6; Width=600; Height=360; YMajorUnit=500; YMinorUnit=100; YAxisNumberformat="$#,##0"; LegendPostion="Bottom"}}}
|
PivotChartDefinition=@{Title="Gross and net by city and product"; ChartType="ColumnClustered"; Column=6; Width=600; Height=360; YMajorUnit=500; YMinorUnit=100; YAxisNumberformat="$#,##0"; LegendPosition="Bottom"}}}
|
||||||
|
|
||||||
$excel = Open-ExcelPackage $path
|
$excel = Open-ExcelPackage $path
|
||||||
$ws1 = $excel.Workbook.Worksheets[1]
|
$ws1 = $excel.Workbook.Worksheets[1]
|
||||||
|
|||||||
Reference in New Issue
Block a user