Dosyaları Açmanın Farklı Yolları
Contents
[
Hide
]
Aspose.Cells for Python via .NET ile dosyaları açmak, veri almak veya geliştirme sürecini hızlandırmak için tasarımcı şablonu kullanmak oldukça basittir.
Bir Excel Dosyasını Yol Üzerinden Nasıl Açılır
Geliştiriciler, yerel bilgisayarda dosya yolunu belirterek Microsoft Excel dosyasını Workbook sınıf yapıcı kullanarak açabilirler. Yolu sadece bir dize olarak geçirin. Aspose.Cells for Python via .NET otomatik olarak dosya biçimini algılayacaktır.
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
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(".") | |
# Opening through Path | |
# Creating a Workbook object and opening an Excel file using its file path | |
workbook1 = Workbook(dataDir + "Book1.xlsx") | |
print("Workbook opened using path successfully!") |
Bir Akış Üzerinden Excel Dosyasını Nasıl Açılır
Ayrıca bir akış olarak bir Excel dosyasını açmak da kolaydır. Bunun için dosyayı içeren Akış nesnesini alan oluşturucunun aşırı yüklenmiş bir sürümünü kullanın.
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
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(".") | |
# Opening through Stream | |
# Create a Stream object | |
fstream = open(dataDir + "Book2.xls", "rb") | |
# Creating a Workbook object, open the file from a Stream object | |
# That contains the content of file and it should support seeking | |
workbook2 = Workbook(fstream) | |
print("Workbook opened using stream successfully!") | |
fstream.close() |
Yalnızca Veri ile Bir Dosyayı Nasıl Açılır
Yalnızca veri ile bir dosyayı açmak için, ilgili sınıfların öznitelik ve seçeneklerini ayarlamak için LoadOptions ve LoadFilter sınıflarını kullanın.
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
from aspose.cells import LoadDataFilterOptions, LoadFilter, LoadFormat, LoadOptions, 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 only specific sheets with data and formulas | |
# Other objects, items etc. would be discarded | |
# Instantiate LoadOptions specified by the LoadFormat | |
loadOptions = LoadOptions(LoadFormat.XLSX) | |
# Set LoadFilter property to load only data & cell formatting | |
loadOptions.load_filter = LoadFilter(LoadDataFilterOptions.CELL_DATA) | |
# Create a Workbook object and opening the file from its path | |
book = Workbook(dataDir + "Book1.xlsx", loadOptions) | |
print("File data imported successfully!") |