This script enables you to export a visualisation to a excel file in a location of the user's choosing.
The script has the following input parameters
Name | Type |
---|---|
vizTable | Visualisation |
ExportData
# Declarations and initial system setup import System import clr clr.AddReference("System.Windows.Forms") from System.Windows.Forms import SaveFileDialog from System.IO import FileStream, FileMode from System.IO import File, StreamWriter from Spotfire.Dxp.Application.Visuals import TablePlot,VisualContent,TablePlotColumnSortMode from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers #-------------------------------------------------------------------------------------- # Dialog box SaveFile = SaveFileDialog() SaveFile.Filter = "Excel Workbook (*.xls)|*.xls" SaveFile.ShowDialog() saveFilename = SaveFile.FileName # Export data writer = Document.Data.CreateDataWriter(DataWriterTypeIdentifiers.ExcelXlsDataWriter) stream = StreamWriter(saveFilename) te = vizTable.As[VisualContent]() te.ExportText(stream) stream.Close() stream.Dispose()