Jump to content

Save As Dialog Error with 'HtmlTextArea' object has no attribute 'ExportText'


Hung Huynh

Recommended Posts

I am trying to create a save as dialog popup. The script prompts for the user to input a file name and file type however I keep getting this error before it stops running:

Traceback (most recent call last): File "", line 21, in AttributeError: 'HtmlTextArea' object has no attribute 'ExportText'

 

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()

SaveFile.Filter = "Excel Workbook (*.xlsx)|*.xlsx" #file type saving to

SaveFile.ShowDialog()

saveFilename = SaveFile.FileName

print "saveFilename=", saveFilename

 

from Spotfire.Dxp.Application.Visuals import VisualContent,TablePlotColumnSortMode

from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers

from System.IO import File, StreamWriter

 

writer = Document.Data.CreateDataWriter(DataWriterTypeIdentifiers.ExcelXlsDataWriter)

stream = StreamWriter(saveFilename)

te = summaryCrossTable.As[VisualContent]()

te.ExportText(stream) # the error occurs here

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...