WebQuery Türünden Dış Veri Bağlantısı ile Çalışmak
Contents
[
Hide
]
Çalışma Kitabı.DataConnections koleksiyonunu kullanarak herhangi bir türdeki harici veri bağlantısına erişebilirsiniz. Bu türden bir veri bağlantısı WebQuery’dir. Bu makale, WebQuery veri bağlantısıyla nasıl çalışılacağını gösterecektir. Microsoft Excel’de Veri > Web’den menüsünü kullanarak WebQuery veri bağlantısı oluşturabilirsiniz.
WebQuery türündeki Harici Veri Bağlantısı ile Çalışma
Aşağıdaki kod, WebQuery türündeki harici veri bağlantısıyla nasıl çalışılacağını göstermektedir. İndirebileceğiniz örnek excel dosyası kullanılmaktadır. Ayrıca bu kodun konsol çıktısını aşağıda görebilirsiniz.
This file contains 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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
Workbook workbook = new Workbook(dataDir + "WebQuerySample.xlsx"); | |
ExternalConnection connection = workbook.DataConnections[0]; | |
if (connection is WebQueryConnection) | |
{ | |
WebQueryConnection webQuery = (WebQueryConnection)connection; | |
Console.WriteLine("Web Query URL: " + webQuery.Url); | |
} |
Konsol Çıkışı
Yukarıdaki kodun örnek excel dosyası‘nın konsol çıktısı aşağıda verilmiştir.
Web Query URL: https://docs.aspose.com/cells/net/