Jump to content

Web Player Excel Export


TousifAhamed Nadaf

Recommended Posts

Hello Tousif,

Below is an Sample code that should work on both Client and Web Player. When you execute the script on WebPlayer the file is exported to the Spotfire Export folder under Web Player server .

===============================

from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers

from System.IO import File, Directory

from System.Collections.Generic import List

table = Document.ActiveDataTableReference

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

allRows = Document.Data.AllRows.GetSelection(table).AsIndexSet()

# directory

if not Directory.Exists("C:\Spotfire_Export"):

Directory.CreateDirectory("C:\Spotfire_Export")

names = []

# columns

stream = File.OpenWrite("C:\Spotfire_Export\Filename.xls")

allColumnNames = List[str]()

for column in table.Columns:

allColumnNames.Add(column.Name)

writer.Write(stream, table, allRows, allColumnNames)

stream.Close()

stream.Dispose()

=============================

Link to comment
Share on other sites

Hello Tousif,

Iron python scripts are executed on Web Player server and thus the files are exported here. If you want to share it with the user then you can export the files to an Network shared drive and share the link with the user.

We cannot replicate the Out of box export functionality with Iron Python, you can create an C# extension for that

Link to comment
Share on other sites

  • 7 months later...
  • 2 years later...

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...