使用 WebQuery 类型的外部数据连接

使用 WebQuery 类型的外部数据连接

以下代码显示了如何使用类型的外部数据连接网络查询.它使用示例 excel 文件您可以从提供的链接下载。您还可以在下面进一步查看此代码的控制台输出。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(WorkingWithExternalDataConnection.class);
Workbook workbook = new Workbook(dataDir + "WebQuerySample.xlsx");
ExternalConnection connection = workbook.getDataConnections().get(0);
if (connection instanceof WebQueryConnection)
{
WebQueryConnection webQuery = (WebQueryConnection)connection;
System.out.println("Web Query URL: " + webQuery.getUrl());
}

控制台输出

这是上面代码的控制台输出示例 excel 文件.

 Web Query URL: http://www.aspose.com/docs/display/cellsnet/Home