Leggi e Scrivi Tabella con Origine Dati Tabella Query
Leggere e scrivere una tabella con dati della tabella di query
Con Aspose.Cells, puoi leggere e scrivere una tabella che ha una QueryTable come origine dati. Il supporto per questa funzionalità esiste anche per i file XLS. Il seguente frammento di codice dimostra la lettura e la scrittura di tale tabella leggendo prima la tabella e quindi modificandola per aggiungere la riga dei totali.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the source directory. | |
string sourceDir = RunExamples.Get_SourceDirectory(); | |
string outputDir = RunExamples.Get_OutputDirectory(); | |
// Load workbook object | |
Workbook workbook = new Workbook(sourceDir + "SampleTableWithQueryTable.xls"); | |
Worksheet worksheet = workbook.Worksheets[0]; | |
ListObject table = worksheet.ListObjects[0]; | |
// Check the data source type if it is query table | |
if (table.DataSourceType == TableDataSourceType.QueryTable) | |
{ | |
table.ShowTotals = true; | |
} | |
// Save the file | |
workbook.Save(outputDir + "SampleTableWithQueryTable_out.xls"); |
I file excel sorgente e di output sono allegati a scopo informativo.