简体   繁体   English

无法解决Spotfire中嵌入的IronPython脚本中的错误

[英]Unable to resolve the error in IronPython script embedded in Spotfire

Hi i am new to python and spotfire. 嗨,我是python和spotfire的新手。 I am unable to resolve the below error. 我无法解决以下错误。
code

import System
from System.IO import FileStream, FileMode
from Spotfire.Dxp.Application.Visuals import TablePlot
from  Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers
import clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import SaveFileDialog  
SaveFile = SaveFileDialog()   #GETS THE FILE PATH FROM THE USER THROUGH A FILEDIALOG
SaveFile.Filter = "xls Format (*.xls)|*.xlsx|*.xls|*.xlsx"
SaveFile.ShowDialog()
saveFilename = SaveFile.FileName
print "saveFilename=", saveFilename
stream = FileStream(saveFilename, FileMode.Create) #Export Table data to the file
vizTable.As[TablePlot]().ExportData(DataWriterTypeIdentifiers.ExcelXlsxDataWriter, stream)
stream.Dispose()

When i run the above code i get the below error. 当我运行上面的代码时,出现以下错误。

System.MissingMemberException: 'NoneType' object has no attribute 'ExportData'

The above code is used to export data to excel sheet using spotfire tool. 上面的代码用于使用Spotfire工具将数据导出到Excel工作表。 Please do suggest me what to do thanks 请建议我该怎么办谢谢

vizTable is empty because in order to have Spotfire to get it populated/initialized vizTable为空,因为为了让Spotfire对其进行填充/初始化

you have to add it as a parameter for a script - in my example below such parameter is called myVisual - after added it can be used in code 您必须将其添加为脚本的参数-在下面的示例中,该参数称为myVisual-添加后可以在代码中使用

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM