Line 254-259: This avoids having to kill the Excel process by clearing all the allocated COM object Sample Usage Export-Xlsx Line 237-248: Creates a chart, if requested, and handles the ChartOnNewSheet switch. Line 228-231: Handles the Borders switch. Line 201-224: Handles the worksheet Title and the Header Colour. Line 186-188: If the Force switch was not used in the call and the requested file already exists, the function will add a timestamp to the name, to guarantee a unique filename. Line 178-184: This part of the code configures the requested location of the worksheet. Line 169-175: If the function discovers that the local Excel installation is not Excel 2010, then the filetype will be changed to XLS. Line 138-163: The input data is collected into a 2-dimensional array. Note that the function can be used in a pipeline, so the Process block will collect all data passed through the pipeline into this WorkingData array. Line 133-135: Copy the data that was passed to the function to the internal WorkingData array. For example the number 28 is converted to the column AB. Line 117-128: An internal helper function that converts a number to an Excel column name. Line 84-102: The enumerated accepted charttypes. Line 82: The default worksheetname is the name of the file Line 81: The default save location is in the user’s home drive and the default filename is Export.Xslx Line 76-80: Parameter validation code block that checks if the requested file is of the type XLS or XLSX $charNumber = $number - ($multiplier * 26) "xlXYScatter","xlXYScatterLines","xlXYScatterLinesNoMarkers","xlXYScatterSmooth", "xlSurface","xlSurfaceTopView","xlSurfaceTopViewWireframe","xlSurfaceWireframe", "xlStockHLC","xlStockOHLC","xlStockVHLC","xlStockVOHLC", "xlPyramidColStacked100","xlRadar","xlRadarFilled","xlRadarMarkers", "xlPieExploded","xlPieOfPie","xlPyramidBarClustered","xlPyramidBarStacked", "xlLineMarkersStacked100","xlLineStacked","xlLineStacked100","xlPie", "xlDoughnutExploded","xlLine","xlLineMarkers","xlLineMarkersStacked", "xlCylinderBarClustered","xlCylinderBarStacked","xlCylinderBarStacked100","xlCylinderCol", "xlConeCol","xlConeColClustered","xlConeColStacked","xlConeColStacked100", "xlColumnStacked100","xlConeBarClustered","xlConeBarStacked","xlConeBarStacked100", "xlBubble","xlBubble3DEffect","xlColumnClustered","xlColumnStacked", "xlBarClustered","xlBarOfPie","xlBarStacked","xlBarStacked100", "xl3DPieExploded","xlArea","xlAreaStacked","xlAreaStacked100", "xl3DColumnStacked","xl3DColumnStacked100","xl3DLine","xl3DPie", "xl3DBarStacked","xl3DBarStacked100","xl3DColumn","xl3DColumnClustered", [ValidateSet("xl3DArea","xl3DAreaStacked","xl3DAreaStacked100","xl3DBarClustered", $WorksheetName = ::GetFileNameWithoutExtension($Path), $Path = (Join-Path $env:HomeDrive "Export.xlsx"),
0 Comments
Leave a Reply. |