[Bug] Absolute row/column index 0 is ignored for images, hyperlinks and comments
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
まず StyleUtil.getCellCoordinate を読みます。issue では、座標のフォールバック元として特定されています。次に、AbstractExcelWriteExecutor 内の呼び出し元を確認します。画像、ハイパーリンク、コメントのアンカーで、絶対座標と相対座標がどのように扱われるかを確認してください。絶対インデックス 0 が優先され、null と負の値ではフォールバック動作が維持されることを完了条件とします。XLSX と XLS の再現手順で確認してください。
索引モデルが issue の本文から書いたものです。
説明
Search before asking
- I searched in the issues and found nothing similar.
Fesod version
main (commit 69147b7)
JDK version
17 (the affected code is JDK-independent)
Operating system
Windows 11 (OS-independent)
Steps To Reproduce
StyleUtil.getCellCoordinate only honors an absolute coordinate when it is > 0:
if (absoluteCoordinate != null && absoluteCoordinate > 0) {
return absoluteCoordinate;
}
Index 0 (row 1 / column A) is a valid zero-based coordinate, but it silently falls back to the relative coordinate or to the position of the cell that carries the data. The method is used for image, hyperlink and comment anchors in AbstractExcelWriteExecutor.
Reproduce with an image:
ImageData imageData = new ImageData();
imageData.setImage(imageBytes);
imageData.setFirstRowIndex(0);
imageData.setFirstColumnIndex(0);
imageData.setLastRowIndex(0);
imageData.setLastColumnIndex(0);
WriteCellData<Void> cellData = new WriteCellData<>(CellDataTypeEnum.EMPTY);
cellData.setImageDataList(new ArrayList<>(Collections.singletonList(imageData)));
List<List<Object>> data = Arrays.asList(
Arrays.asList("row1", "value1"),
Arrays.asList("row2", "value2"),
Arrays.asList("row3", cellData)); // written to B4 (one head row)
FesodSheet.write(file)
.head(Arrays.asList(Collections.singletonList("Name"), Collections.singletonList("Image")))
.sheet()
.doWrite(data);
Current Behavior
The picture is anchored at B4 (the data cell) instead of A1, for both XLSX and XLS. When a relative coordinate is also set, the relative value wins over the absolute 0.
Expected Behavior
An absolute index of 0 is honored, and it takes precedence over the relative index. This matches the CoordinateData Javadoc ("Priority is higher than relative...").
Anything else?
Proposed fix: change the check to absoluteCoordinate >= 0. null and negative values keep the current fallback behavior, so existing callers that do not set absolute coordinates are unaffected.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- 主要言語
- Java
- スター
- 6.3k
- フォーク
- 554
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 44
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/fesod のほかの issue
-
[DISCUSS] Commit Signature Verification対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdiscussion welcome security stale waiting for feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
apache/fesod#1184 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] xlsx stream write leaves temp file対応中かも @nkuprins が 35 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/fesod#1137 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[bug]Custom converters with supportExcelTypeKey() == null are silently ignored when writing CSV対応中かも @Mikkey-f が 66 日前に担当しました。 オープン
難易度 2/5 半日 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
[Task] Correct source attribution and align copyright years following LEGAL-737対応中かも @himanchalkaushale が 2 日前に担当しました。 オープンgood first issue
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/fesod#1322 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
discussion welcome
難易度 3/5 1〜2日 初心者へのやさしさ 15/100
apache/fesod#1308 · コメント 3 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
SasanLabs/VulnerableApp#912 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
desktop edt not responding
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
datafusion-contrib/StreamFusion#653 ·
メンテナーはふだん 1 日以内に返信
-
Four TestConstraintBasedAlgorithm tests pass when nothing is thrown対応中かも @sharanggupta が今日担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100