This sample demonstrates the use of Select statement on a datatable to limit the number of rows to be exported to xls.
Introduction
This sample demonstrates the use of Select statement on a datatable to limit the number of rows to be exported to xls.
Code Sample
# Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from Spotfire.Dxp.Data import * from System.Collections.Generic import List from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers from System.IO import File table = Document.Data.Tables["World Bank Data"] rowSelection=table.Select("country='USA'") cols = ['country','state'] rows = rowSelection.AsIndexSet() writer = Document.Data.CreateDataWriter(DataWriterTypeIdentifiers.ExcelXlsDataWriter) stream = File.OpenWrite("C:tempmyexport.xls") writer.Write(stream, table, rows,cols) stream.Close() stream.Dispose()
References
- API Reference: DataTable Select
- API Reference: ExcelXlsDataWriter
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.