Dosyaları Açmanın Farklı Yolları

Yol Yoluyla Dosya Açma

Geliştiriciler, dosya yolunu kullanarak bir Microsoft Excel dosyasını yerel bilgisayarda belirterek açabilirler.IÇalışma Kitabısınıf oluşturucu Yapıcıdaki yolu String olarak geçirmeniz yeterlidir. Aspose.Cells, dosya biçimi türünü otomatik olarak algılar.

//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
//Source directory path
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\");
//Create Workbook object from an Excel file path
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(dirPath->StringAppend(new String("sampleExcelFile.xlsx")));
//Show following message on console
Console::WriteLine(new String("Workbook opened successfully using file path."));

Akış Kullanarak Dosya Açma

Bir Excel dosyasını akış olarak açmak da mümkündür. Bunu yapmak için, yapıcının aşırı yüklenmiş bir sürümünü kullanın.Aktarımdosyayı içeren nesne.

//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
//Source directory path
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\");
//Create a Stream object
intrusive_ptr<FileStream> fstream = new FileStream(dirPath->StringAppend(new String("sampleExcelFile.xlsx")), FileMode_Open);
//Create Workbook object from a Stream object
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(fstream);
//Show following message on console
Console::WriteLine(new String("Workbook opened successfully using stream."));
//Close the Stream object
fstream->Close();