Leggi e Scrivi Tabella con Origine Dati Tabella Query
Contents
[
Hide
]
Leggere e scrivere una tabella con dati della tabella di query
Con Aspose.Cells for Python via Java, è possibile leggere e scrivere una tabella che ha un QueryTable come origine dati. Il supporto per questa funzionalità esiste anche per i file XLS. Il seguente snippet di codice dimostra la lettura e la scrittura di tale tabella, leggendo prima la tabella e quindi modificandola per aggiungere la riga dei totali.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source_directory = "Examples/SampleFiles/SourceDirectory/" | |
output_directory = "Examples/SampleFiles/OutputDirectory/" | |
# Load workbook object | |
workbook = Workbook(source_directory + "SampleTableWithQueryTable.xls") | |
worksheet = workbook.getWorksheets().get(0) | |
# Access first list object or table | |
listObj = worksheet.getListObjects().get(0) | |
# Check the data source type if it is query table | |
if (listObj.getDataSourceType() == TableDataSourceType.QUERY_TABLE): | |
listObj.setShowTotals(True) | |
# Save the excel file. | |
workbook.save(output_directory + "SampleTableWithQueryTable_out.xls") |
I file excel sorgente e di output sono allegati a scopo informativo.