Skip to content

Conversation

@FlorianRauscha
Copy link

This adds the ability to embed images in worksheet cells with support for:

  • PNG, JPEG, GIF raster formats with automatic detection via byte headers
  • SVG vector format (Office 2016+) with automatic detection
  • One-cell anchoring (fixed size at cell position)
  • Two-cell anchoring (image spans and resizes with cell range)
  • Custom anchoring with pixel offsets via PictureAnchor

New classes:

  • ImageType: Enum for supported formats with byte header detection
  • Picture: Represents an embedded image with XML writing
  • PictureAnchor: EMU-based positioning (one-cell/two-cell anchors)
  • Pictures: Collection manager for worksheet images

API additions to Worksheet:

  • addImage(row, col, imageData, widthPx, heightPx) - one-cell anchor
  • addImage(fromRow, fromCol, toRow, toCol, imageData) - two-cell anchor
  • addImage(anchor, imageData) - custom anchor
  • addImage(anchor, imageData, name, lockAspectRatio) - full control

Images coexist properly with comments (separate drawing relationships). Includes comprehensive unit tests with Apache POI validation.

This adds the ability to embed images in worksheet cells with support for:
- PNG, JPEG, GIF raster formats with automatic detection via byte headers
- SVG vector format (Office 2016+) with automatic detection
- One-cell anchoring (fixed size at cell position)
- Two-cell anchoring (image spans and resizes with cell range)
- Custom anchoring with pixel offsets via PictureAnchor

New classes:
- ImageType: Enum for supported formats with byte header detection
- Picture: Represents an embedded image with XML writing
- PictureAnchor: EMU-based positioning (one-cell/two-cell anchors)
- Pictures: Collection manager for worksheet images

API additions to Worksheet:
- addImage(row, col, imageData, widthPx, heightPx) - one-cell anchor
- addImage(fromRow, fromCol, toRow, toCol, imageData) - two-cell anchor
- addImage(anchor, imageData) - custom anchor
- addImage(anchor, imageData, name, lockAspectRatio) - full control

Images coexist properly with comments (separate drawing relationships).
Includes comprehensive unit tests with Apache POI validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant