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

处理 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