BuiltInDocumentPropertyCollectionクラスからファイルのプロパティを抽出しています。
しかし、下記のサンプルデータを処理した場合、
Workbook.getBuiltInDocumentProperties()で取得したインスタンスの要素が空になってしまいます。
(Excelから見るとファイルにプロパティは設定されています。)
Workbook workbook= new Workbook(inputStream);
// プロパティ取得
BuiltInDocumentPropertyCollection builtInDocumentProperties = workbook.getBuiltInDocumentProperties();
使用バージョン:Aspose.Cells for Java 18.4
サンプルデータ:https://www.crefc.org/uploadedFiles/CMSA_Site_Home/Industry_Standards/CMSA-Investor_Reporting_Package/US/Data_Dictionary.xls
この問題を回避し、プロパティを抽出する方法はございますでしょうか。
お手数おかけしますが、ご確認の程よろしくお願いいたします。
@yudai_yamaguchi,
テンプレートファイルとサンプルコードセッションをありがとう。
最初のテストの後、テンプレートファイルで次のサンプルコードを使用するのと同様に問題を再現できます。 私は、組み込み/カスタムの "プロパティ"がテンプレートファイルで抽出されていないことに気付きました。 例外があります。 オブジェクトが空であるという意味は "java.lang.IndexOutOfBoundsException"です。
例えば
サンプルコード:
Workbook workbook = new Workbook("f:\\files\\Data_Dictionary.xls");
// Retrieve a list of all custom document properties of the Excel file
DocumentPropertyCollection customProperties = workbook.getWorksheets().getCustomDocumentProperties();
// Accessing a custom document property
DocumentProperty customProperty1 = customProperties.get(0);//Exception
// Storing the value of the document property as an object
Object objectValue = customProperty1.getValue();
System.out.println(objectValue);
//OR
//BuiltInDocumentPropertyCollection builtInDocumentProperties = workbook.getBuiltInDocumentProperties();
// Accessing a built-in document property
//DocumentProperty property2 = builtInDocumentProperties.get(0);//Exception
あなたの問題のためにID "CELLSJAVA - 42598"のチケットを記録しました。 私たちはすぐにそれを調査します。
更新がある場合は、ここでお知らせします。
チケット作成のご対応ありがとうございました。
以上、よろしくお願いいたします。
@yudai_yamaguchi
CELLSJAVA-42598の問題が修正されたことをお知らせするためです。 QAを実行した後、すぐに修正を提供し、その他の拡張機能や修正が含まれます。
The issues you have found earlier (filed as CELLSJAVA-42598) have been fixed in Aspose.Cells for Java 18.5. Please also see the document for your reference: Installation|Documentation