Excel 2016 Grafiklerini Okuma ve Değiştirme
Olası Kullanım Senaryoları
Aspose.Cells for Python via .NET, Microsoft Excel 2016 grafiklerini okuma ve bunlar üzerinde değişiklik yapma desteğine sahiptir ve bunlar, Microsoft Excel 2013 veya daha eski sürümlerde bulunmamaktadır.
Excel 2016 Grafiklerini Okuma ve Değiştirme
Aşağıdaki örnek kod, Excel 2016 grafiklerini içeren kaynak excel dosyasını yükler. Tüm grafikleri tek tek okur ve türüne göre başlığını değiştirir. Aşağıdaki ekran görüntüsü, kodun çalıştırılması öncesi kaynak excel dosyasını göstermektedir. Görebileceğiniz gibi, grafik başlığı tüm grafikler için aynıdır.
Aşağıdaki ekran görüntüsü, kodun çalıştırılması sonrası çıktı excel dosyasını göstermektedir. Görebileceğiniz gibi, grafik başlığı türüne göre değişmiştir.
Örnek Kod
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Load source excel file containing excel 2016 charts | |
book = Workbook(dataDir + "excel2016Charts.xlsx") | |
# Access the first worksheet which contains the charts | |
sheet = book.worksheets[0] | |
# Access all charts one by one and read their types | |
for i in range(len(sheet.charts)): | |
# Access the chart | |
ch = sheet.charts[i] | |
# Print chart type | |
print(ch.type) | |
# Change the title of the charts as per their types | |
ch.title.text = "Chart Type is " + str(ch.type) | |
# Save the workbook | |
book.save(dataDir + "out_excel2016Charts.xlsx") |
Konsol Çıktısı
Yukarıdaki örnek kodun kaynak excel dosyası ile çalıştırılması sonucu konsol çıktısı
Waterfall
Treemap
Sunburst
Histogram
BoxWhisker