Sorgu Tablosu Veri Kaynağı ile Tablo Okuma ve Yazma
Sorgu Tablosu Veri Kaynağı ile Tablo Okuma ve Yazma
Aspose.Cells ile, Veri Kaynağı olarak Sorgu Tablosu bulunan bir tabloyu okuyup yazabilirsiniz. Bu özellik XLS dosyaları için de mevcuttur. Aşağıdaki kod parçası önce tabloyu okuyarak ardından toplam satır ekleyerek böyle bir tabloyu okumanın ve yazmanın nasıl gerçekleştirileceğini açıklar.
// 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"); |
Kaynak ve çıktı excel dosyaları referans için ekte sunulmuştur.