Sorgu Tablosu Veri Kaynağı ile Tablo Okuma ve Yazma

Sorgu Tablosu Veri Kaynağı ile Tablo Okuma ve Yazma

Aspose.Cells for Python via .NET ile, Veri Kaynağı olarak QueryTable içeren bir tabloyu okuma ve yazma yapabilirsiniz. Bu özellik, XLS dosyaları için de desteklenir. Aşağıdaki kod parçası, önce tabloyu okur, sonra toplam satırını eklemek için değiştirir.

from aspose.cells import Workbook
from aspose.cells.tables import TableDataSourceType
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the source directory.
sourceDir = RunExamples.Get_SourceDirectory()
outputDir = RunExamples.Get_OutputDirectory()
# Load workbook object
workbook = Workbook(sourceDir + "SampleTableWithQueryTable.xls")
worksheet = workbook.worksheets[0]
table = worksheet.list_objects[0]
# Check the data source type if it is query table
if table.data_source_type == TableDataSourceType.QUERY_TABLE:
table.show_totals = True
# Save the file
workbook.save(outputDir + "SampleTableWithQueryTable_out.xls")

Kaynak ve çıktı excel dosyaları referans için ekte sunulmuştur.

Kaynak Dosya

Çıkış Dosyası