mirror of
https://github.com/dfinke/ImportExcel.git
synced 2026-01-07 02:53:32 +00:00
Added try catch for psd1 loading so it can be copy pasted to the console
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
function plot {
|
||||
param(
|
||||
$f,
|
||||
@@ -7,18 +9,18 @@ function plot {
|
||||
|
||||
$minx=[math]::Round($minx,1)
|
||||
$maxx=[math]::Round($maxx,1)
|
||||
|
||||
$file = 'C:\temp\plot.xlsx'
|
||||
rm $file -ErrorAction Ignore
|
||||
|
||||
$file = 'C:\temp\plot.xlsx'
|
||||
Remove-Item $file -ErrorAction Ignore
|
||||
|
||||
$c = New-ExcelChart -XRange X -YRange Y -ChartType Line -NoLegend -Title Plot -Column 2 -ColumnOffSetPixels 35
|
||||
|
||||
|
||||
$(for ($i = $minx; $i -lt $maxx-.1; $i+=.1) {
|
||||
[pscustomobject]@{
|
||||
X=$i.ToString("N1")
|
||||
Y=(&$f $i)
|
||||
}
|
||||
}) | Export-Excel $file -Show -AutoNameRange -ExcelChartDefinition $c
|
||||
}) | Export-Excel $file -Show -AutoNameRange -ExcelChartDefinition $c
|
||||
}
|
||||
|
||||
function pi {[math]::pi}
|
||||
|
||||
Reference in New Issue
Block a user