OData 接続情報を取得する方法
Contents
[
Hide
]
OData 接続情報を取得する
開発者が Excel ファイルから OData 情報を抽出する必要がある場合があります。 Aspose.Cells はWorkbook.DataMashupExcel ファイルに存在する DataMashup 情報を返すプロパティ。この情報は、DataMashup クラスによって表されます。 DataMashup クラスは、PowerQueryFormulaColllction コレクションを返す PowerQueryFormulas プロパティを提供します。 PowerQueryFormulaColllction から、PowerQueryFormula と PowerQueryFormulaItem にアクセスできます。
次のコード スニペットは、これらのクラスを使用して OData 情報を取得する方法を示しています。
次のコード スニペットで使用されているソース ファイルは、参照用に添付されています。
サンプルコード
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-Java | |
// The path to the directories. | |
String sourceDir = Utils.Get_SourceDirectory(); | |
Workbook workbook = new Workbook(sourceDir + "ODataSample.xlsx"); | |
PowerQueryFormulaCollction PQFcoll = workbook.getDataMashup().getPowerQueryFormulas(); | |
for (Object obj : PQFcoll) | |
{ | |
PowerQueryFormula PQF = (PowerQueryFormula)obj; | |
System.out.println("Connection Name: " + PQF.getName()); | |
PowerQueryFormulaItemCollection PQFIcoll = PQF.getPowerQueryFormulaItems(); | |
for (Object obj2 : PQFIcoll) | |
{ | |
PowerQueryFormulaItem PQFI = (PowerQueryFormulaItem)obj2; | |
System.out.println("Name: " + PQFI.getName()); | |
System.out.println("Value: " + PQFI.getValue()); | |
} | |
} |
コンソール出力
接続名: 注文
名前: ソース
値: OData.Feed(“https://services.odata.org/V3/Northwind/Northwind.svc/", null, [Implementation=“2.0”])
名前: Orders_table
値: ソース{[名前=“注文”,署名=“テーブル”]}[データ]