mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-15 07:43:23 +00:00
Further updates to on-line help
This commit is contained in:
@@ -1142,7 +1142,10 @@ function Add-WorkSheet {
|
|||||||
function Select-Worksheet {
|
function Select-Worksheet {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the selected tab in an Excel workbook to be a Particular sheet, and unselects all the others.
|
Sets the selected tab in an Excel workbook to be the chosen sheet, and unselects all the others.
|
||||||
|
.DESCRIPTION
|
||||||
|
Sometimes when a sheet is added we want it to be the active sheet, sometimes we want the active sheet to be left as it was.
|
||||||
|
Select-Worksheet exists to change the which sheet is the selected tab when Excel opens the file.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Select-Worksheet -ExcelWorkbook $ExcelWorkbook -WorksheetName "NewSheet"
|
Select-Worksheet -ExcelWorkbook $ExcelWorkbook -WorksheetName "NewSheet"
|
||||||
$ExcelWorkbook holds the a workbook object containing a sheet named "NewSheet";
|
$ExcelWorkbook holds the a workbook object containing a sheet named "NewSheet";
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
Function Open-ExcelPackage {
|
Function Open-ExcelPackage {
|
||||||
<#
|
<#
|
||||||
.Synopsis
|
.Synopsis
|
||||||
Returns an Excel Package Object with for the specified XLSX ile
|
Returns an Excel Package Object for the specified XLSX file
|
||||||
|
.Description
|
||||||
|
Import-Excel and Export-Excel open an Excel file, carry out their tasks and close it again.
|
||||||
|
Sometimes it is necessary to open a file and do other work on it. Open-Excel package allows the file to be opened for these tasks.
|
||||||
|
It takes a KillExcel switch to make sure Excel is not holding the file open; a password parameter for existing protected files,
|
||||||
|
and a create switch to set-up a new file if no file already exists.
|
||||||
.Example
|
.Example
|
||||||
$excel = Open-ExcelPackage -path $xlPath
|
$excel = Open-ExcelPackage -path $xlPath
|
||||||
$sheet1 = $excel.Workbook.Worksheets["sheet1"]
|
$sheet1 = $excel.Workbook.Worksheets["sheet1"]
|
||||||
@@ -18,6 +23,7 @@
|
|||||||
[Parameter(Mandatory=$true)]$Path,
|
[Parameter(Mandatory=$true)]$Path,
|
||||||
#If specified, any running instances of Excel will be terminated before opening the file.
|
#If specified, any running instances of Excel will be terminated before opening the file.
|
||||||
[switch]$KillExcel,
|
[switch]$KillExcel,
|
||||||
|
#The password for a protected worksheet, as a [normal] string (not a secure string.)
|
||||||
[String]$Password,
|
[String]$Password,
|
||||||
#By default open only opens an existing file; -Create instructs it to create a new file if required.
|
#By default open only opens an existing file; -Create instructs it to create a new file if required.
|
||||||
[switch]$Create
|
[switch]$Create
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
$PivotColumns,
|
$PivotColumns,
|
||||||
#Fields to use to filter in the Pivot table
|
#Fields to use to filter in the Pivot table
|
||||||
$PivotFilter,
|
$PivotFilter,
|
||||||
#By default Pivot tables have Totals for each Row (on the right) and for each column at the bottom. This allows just one or neither to be selected.
|
#If there are multiple datasets in a PivotTable, by default they are shown seperatate rows under the given row heading; this switch makes them seperate columns.
|
||||||
[Switch]$PivotDataToColumn,
|
[Switch]$PivotDataToColumn,
|
||||||
#Define whther totals should be added to rows, columns neither, or both (the default is both)
|
#Define whther totals should be added to rows, columns neither, or both (the default is both)
|
||||||
[ValidateSet("Both","Columns","Rows","None")]
|
[ValidateSet("Both","Columns","Rows","None")]
|
||||||
@@ -233,8 +233,10 @@ function New-PivotTableDefinition {
|
|||||||
$PivotColumns,
|
$PivotColumns,
|
||||||
#Fields to use to filter in the Pivot table
|
#Fields to use to filter in the Pivot table
|
||||||
$PivotFilter,
|
$PivotFilter,
|
||||||
|
#If there are multiple datasets in a PivotTable, by default they are shown seperatate rows under the given row heading; this switch makes them seperate columns.
|
||||||
[Switch]$PivotDataToColumn,
|
[Switch]$PivotDataToColumn,
|
||||||
#By default Pivot tables have Totals for each Row (on the right) and for each column at the bottom. This allows just one or neither to be selected.
|
#By default Pivot tables have Totals for each Row (on the right) and for each column at the bottom. This allows just one or neither to be selected.
|
||||||
|
#Define whther totals should be added to rows, columns neither, or both (the default is both)
|
||||||
[ValidateSet("Both","Columns","Rows","None")]
|
[ValidateSet("Both","Columns","Rows","None")]
|
||||||
[String]$PivotTotals = "Both",
|
[String]$PivotTotals = "Both",
|
||||||
#Included for compatibility - equivalent to -PivotTotals "None"
|
#Included for compatibility - equivalent to -PivotTotals "None"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
When given a valid URI set-Column makes it a hyperlink The column will be autosized to fit the links.
|
When given a valid URI set-Column makes it a hyperlink The column will be autosized to fit the links.
|
||||||
#>
|
#>
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
|
[OutputType([OfficeOpenXml.ExcelColumn],[String])]
|
||||||
Param (
|
Param (
|
||||||
#If specifing the worksheet by name the ExcelPackage object which contains it needs to be passed
|
#If specifing the worksheet by name the ExcelPackage object which contains it needs to be passed
|
||||||
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
The script block can use $row, $column, $ColumnName, $startRow/Column $endRow/Column
|
The script block can use $row, $column, $ColumnName, $startRow/Column $endRow/Column
|
||||||
#>
|
#>
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
|
[OutputType([OfficeOpenXml.ExcelRow],[String])]
|
||||||
Param (
|
Param (
|
||||||
#An Excel package object - e.g. from Export-Excel -passthru - requires a sheet name
|
#An Excel package object - e.g. from Export-Excel -passthru - requires a sheet name
|
||||||
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Applies Number, font, alignment and colour formatting to a range of Excel Cells
|
Applies Number, font, alignment and colour formatting to a range of Excel Cells
|
||||||
|
.DESCRIPTION
|
||||||
|
Set-Format was created to set the style elements for a range of cells, this includes autosizing and hiding, setting
|
||||||
|
font elements (Name, Size, Bold, Italic, Underline & UnderlineStyle and Subscript & SuperScript), font and background colors,
|
||||||
|
borders, text wrapping, rotation, aliginment within cells, and number format.
|
||||||
|
It has been extended to set Values, Formulas and set ArrayFormulas (sometimes called Ctrl-shift-Enter [CSE] formulas); because of this
|
||||||
|
it has an alias of Set-ExcelRange - in the future the Alias and Canonical name may swapped.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
$sheet.Column(3) | Set-Format -HorizontalAlignment Right -NumberFormat "#,###"
|
$sheet.Column(3) | Set-Format -HorizontalAlignment Right -NumberFormat "#,###"
|
||||||
Selects column 3 from a sheet object (within a workbook object, which is a child of the ExcelPackage object) and passes it to Set-Format which formats as an integer with comma seperated groups
|
Selects column 3 from a sheet object (within a workbook object, which is a child of the ExcelPackage object) and passes it to Set-Format which formats as an integer with comma seperated groups
|
||||||
@@ -9,6 +15,7 @@
|
|||||||
Set-Format -Address $sheet.Cells["E1:H1048576"] -HorizontalAlignment Right -NumberFormat "#,###"
|
Set-Format -Address $sheet.Cells["E1:H1048576"] -HorizontalAlignment Right -NumberFormat "#,###"
|
||||||
Instead of piping the address in this version specifies a block of cells and applies similar formatting
|
Instead of piping the address in this version specifies a block of cells and applies similar formatting
|
||||||
#>
|
#>
|
||||||
|
[cmdletbinding()]
|
||||||
Param (
|
Param (
|
||||||
#One or more row(s), Column(s) and/or block(s) of cells to format
|
#One or more row(s), Column(s) and/or block(s) of cells to format
|
||||||
[Parameter(ValueFromPipeline = $true,ParameterSetName="Address",Mandatory=$True,Position=0)]
|
[Parameter(ValueFromPipeline = $true,ParameterSetName="Address",Mandatory=$True,Position=0)]
|
||||||
|
|||||||
Reference in New Issue
Block a user