ワークブックに非表示の外部リンクが含まれているかどうかを確認する
考えられる使用シナリオ
ワークブックには、Microsoft Excel で表示できない非表示の外部リンクが含まれている場合があります。 Aspose.Cells は、表示されているかどうかに関係なく、すべての外部リンクを取得します。ただし、次のことを確認できます。ExternalLink.IsVisible 外部リンクが表示されているかどうかを確認するプロパティ
ワークブックに非表示の外部リンクが含まれているかどうかを確認する
次のサンプル コードは、ソースエクセルファイル 非表示の外部リンクが含まれています。これらのリンクは Microsoft Excel では表示できませんが、ブック内には存在します。印刷後ExternalLink.DataSource とExternalLink.IsReferred プロパティ、それはExternalLink.IsVisible 財産。以下のコンソール出力では、外部リンクがすべて表示されていないことがわかります。
サンプルコード
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 documents directory.
String dataDir = Utils.getSharedDataDir(CheckWorkbookContainsHiddenExternalLinks.class) + "articles/";
// Loads the workbook which contains hidden external links
Workbook workbook = new Workbook(dataDir + "CheckWorkbookContainsHiddenExternalLinks_in.xlsx");
// Access the external link collection of the workbook
ExternalLinkCollection links = workbook.getWorksheets().getExternalLinks();
// Print all the external links and check there IsVisible property
for (int i = 0; i < links.getCount(); i++) {
System.out.println("Data Source: " + links.get(i).getDataSource());
System.out.println("Is Referred: " + links.get(i).isReferred());
System.out.println("Is Visible: " + links.get(i).isVisible());
System.out.println();
コンソール出力
以下は、上記のサンプル コードを特定のコマンドで実行したときのコンソール出力です。サンプルエクセルファイル .
Copy Data Source : C : \ International \ DDB \ FAS 133 \ Swap Rates \ GS_1M_3M_1_2_5_ ¥ $_ ( B ) IRSwaps_0400 . xls
Is Referred : True
Is Visible : False
Data Source : C : \ DIST DAY \ MAY TEMPLATES \ 030601t . xls
Is Referred : True
Is Visible : False
Data Source : C : \ AREVIEW \ 2002 Controllable \ Autobrct . xls
Is Referred : True
Is Visible : False
Data Source : C : \ CARDSFO \ Main Files \ Rate Forecast \ FY 11 \ IFR 11 01 ( New Model REPORTS 11 . 08 . 07 ). xls
Is Referred : True
Is Visible : False