diff --git a/Examples/Join-Worksheet/Join-worksheet-blocks.sample.ps1 b/Examples/Join-Worksheet/Join-worksheet-blocks.sample.ps1 new file mode 100644 index 0000000..81976f4 --- /dev/null +++ b/Examples/Join-Worksheet/Join-worksheet-blocks.sample.ps1 @@ -0,0 +1,11 @@ + +$path = "$env:TEMP\Test.xlsx" +Remove-item -Path $path -ErrorAction SilentlyContinue + Get-WmiObject -Class win32_logicaldisk | + Select-Object -Property DeviceId,VolumeName, Size,Freespace | + Export-Excel -Path $path -WorkSheetname Volumes -NumberFormat "0,000" +Get-NetAdapter | + Select-Object -Property Name,InterfaceDescription,MacAddress,LinkSpeed | + Export-Excel -Path $path -WorkSheetname NetAdapters + +Join-Worksheet -Path $path -HideSource -WorkSheetName Summary -NoHeader -LabelBlocks -AutoSize -Title "Summary" -TitleBold -TitleSize 22 -show diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index a93367a..94964e2 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -390,8 +390,8 @@ elseif ($_[0] -notmatch '[a-z]') { throw 'Tablename starts with an invalid character.' } else { $true } })] - [Parameter(ParameterSetName = 'Table' , Mandatory = $true)] - [Parameter(ParameterSetName = 'PackageTable' , Mandatory = $true)] + [Parameter(ParameterSetName = 'Table' , Mandatory = $true, ValueFromPipelineByPropertyName)] + [Parameter(ParameterSetName = 'PackageTable' , Mandatory = $true, ValueFromPipelineByPropertyName)] [String]$TableName, [Parameter(ParameterSetName = 'Table')] [Parameter(ParameterSetName = 'PackageTable')] diff --git a/Join-Worksheet.ps1 b/Join-Worksheet.ps1 index fe4aa02..0779f29 100644 --- a/Join-Worksheet.ps1 +++ b/Join-Worksheet.ps1 @@ -24,10 +24,10 @@ .EXAMPLE Get-WmiObject -Class win32_logicaldisk | select -Property DeviceId,VolumeName, Size,Freespace | - Export-Excel -Path "$env:computerName.xlsx" -WorkSheetname Volumes + Export-Excel -Path "$env:computerName.xlsx" -WorkSheetname Volumes -NumberFormat "0,000" Get-NetAdapter | Select-Object Name,InterfaceDescription,MacAddress,LinkSpeed | Export-Excel -Path "$env:COMPUTERNAME.xlsx" -WorkSheetname NetAdapter - Join-Worksheet -Path "$env:COMPUTERNAME.xlsx" -WorkSheetName Summay -Title "Summary" -TitleBold -TitleSize 22 -NoHeader -LabelBlocks -AutoSize -HideSource + Join-Worksheet -Path "$env:COMPUTERNAME.xlsx" -WorkSheetName Summary -Title "Summary" -TitleBold -TitleSize 22 -NoHeader -LabelBlocks -AutoSize -HideSource -show The first two command get logical disk and network card information; each type is exported to its own sheet in a workbook. The Join-worksheet command copies both onto a page named "Summary". Because the data is disimilar -NoHeader is specified, ensuring the whole of each page is copied. diff --git a/README.md b/README.md index 6423db5..cda80e7 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,15 @@ To install to your personal modules folder (e.g. ~\Documents\WindowsPowerShell\M iex (new-object System.Net.WebClient).DownloadString('https://raw.github.com/dfinke/ImportExcel/master/Install.ps1') ``` -# What's new to 6th July 18 +# What's new to 7th July 18 - Moved chart creatation into its own function (Add-Excel chart) within Export-Excel.ps1. Renamed New-Excelchart to New-ExcelChartDefinition to make it clearer that it is not making anything in the workbook (but for compatiblity put an alias of New-ExcelChart in so existing code does not break). Found that -Header does nothing, so it isn't Add-Excel chart and there is a message that does nothing in New-ExcelChartDefinition . - Added paramters for managing Axes and legend (these are currently in Add-ExcelChart but not new-ExcelChartDefinition) - Fixed a bug introduced into Compare-Worksheet by the change descibed in the June changes below, this meant the font color was only being set in one sheet, when a row was changed. Also found that the PowerShell ISE and shell return Compare-Object resuls in different sequences which broke some tests. Applied a sort to ensure things are in a predictable order. (#375) - Fixed some bad code which had been checked-in in-error and caused adding charts to break. (This was not seen outside Github #377) - Added chart tests to Export-Excel.tests.ps1. - Removed (2) calls to Get-ExcelColumnName -- Fixed an issue in Export-Excel where formulas were inserted as strings if "NoNumberConversion" is applied (#374), and made sure formatting is applied to formula cells +- Fixed an issue in Export-Excel where formulas were inserted as strings if "NoNumberConversion" is applied (#374), and made sure formatting is applied to formula cells +- Fixed an issue with parameter sets in Export-Excel not being determined correctly in some case (I think this has been resolved before and might have regressed) - Reverted the [double]::tryParse in export excel to the previous way, as the shorter way was not behaving correctly with with the number formats in certain regions. (also #374) - Changed Table, Range and AutoRangeNames to apply to whole data area if no data has been inserted OR to inserted data only if it has.(#376) This means that if there are multiple inserts only inserted data is touched, rather than going as far down and/or right as the furthest used cell. Added a test for this. - Added more of the Parameters from Export-Excel to Join-worksheet, join just calls export with these parameters so there is no code behind them (#383)