1016 Commits

Author SHA1 Message Date
Yongho Hwang
8d53613bcf
Bug 69935: Add short-based column setters to ClientAnchor (#1006)
* Bug 69935: Add short-based column setters to ClientAnchor

Introduce short-based column setters on ClientAnchor to complement the existing int-based setters and improve Kotlin property support.

- Add default short setters setCol1(short) and setCol2(short) that delegate to the existing int-based setters.
- Add TestClientAnchorShortSetter to verify both the new short-based setters and the existing int-based setters.

Tests:
- ./gradlew :poi:test --tests 'org.apache.poi.ss.usermodel.TestClientAnchorShortSetter'

* Replace @since TBD with 6.0.0

* Add license header to TestClieAdd ASF license header to TestClientAnchorShortSetterntAnchorShortSetter.java

Added license header to TestClientAnchorShortSetter.java
2026-02-14 09:50:52 +01:00
Dominik Stadler
d1f3f9489f Add check for too large allocation in SharedFormulaGroup
A malformed spreadsheet could trigger a very large allocation.

Can be overruled by users via IOUtils.setByteArrayMaxOverride().

Fixes https://issues.oss-fuzz.com/issues/476431391
2026-01-18 18:28:36 +01:00
Dominik Stadler
beab88fb0e Remove obsolete if-condition
All branches perform the same action now anyway
2026-01-18 18:28:36 +01:00
Dominik Stadler
66109187d1 Only allocate the required size for EscherComplexProperty
Otherwise a malformed document can cause OOM by reserving
large chunks of memory, but only using little of it.

This fixes https://issues.oss-fuzz.com/issues/476184826
2026-01-18 18:28:36 +01:00
Dominik Stadler
c9b37678cc Introduce getComplexSize()
To not materialize the array only to get its size
2026-01-18 18:28:35 +01:00
Jacobo Aragunde Pérez
372388b7ed
Support rendering transparent bitmaps in presentations. (#990)
* Support rendering transparent bitmaps in presentations.

Add PictureShape.getAlpha() method and implementations for HSLF and
XSLF. Then make use of it in DrawPictureShape to apply the right alpha
value to the picture being drawn.

Fixed a bug in BitmapImageRenderer that considered alpha value 0 as
"fully opaque", when it means "fully transparent" instead.

Finally, added a test for this feature in TestDrawPictureShape for XSLF.
A test for HSLF could not be created because it was not possible to
generate a test file with today's tools; MS Office removes the
bitmap transparency effect when saving as .ppt, and LibreOffice blends
it into the bitmap.

* Address reviewer comments.

* Add comment about default alpha value.

* Prevent NPE in XSLFPictureShape.getAlpha().

* Change wording in comments to avoid the word "percentage".

* Use static vars for extreme alpha values.
2026-01-17 13:47:09 +01:00
Dominik Stadler
2acb5cf66a Avoid several NPEs
When retrieving picture data
When retrieving text in slides
When handling XSLFTableStyles
In EmbeddedExtractor if ShapeName is not set
In HSSF with invalid EscherSpRecord
In HSSF with invalid RecordStreams
When drawing arcs for shapes in slides
In HSSFPicture.getPictureIndex
Adjust "opens" for tests in poi-ooxml

Either handle it gracefully or throw
IllegalStateException instead for broken files
2026-01-16 18:49:27 +01:00
Dominik Stadler
18ef01295d Avoid some NPEs when handling LinkTables 2026-01-12 06:48:24 +01:00
Dominik Stadler
a5f5f4294e Avoid NPE when reading a broken xlsb file
Throw a more useful exception instead
2026-01-12 06:48:23 +01:00
PJ Fanning
ba04c61188 format methods 2026-01-11 10:34:54 +01:00
Dominik Stadler
f8a8189230 Use the proper add-method to perform the check for max number of children
If adding is done without check it can trigger OOM when fuzzing.

This should fix https://issues.oss-fuzz.com/issues/391709145
2026-01-10 13:14:34 +01:00
Dominik Stadler
95b2a1cf1d Avoid NPE with broken files when reading xls file 2026-01-10 13:14:34 +01:00
Dominik Stadler
017ff5f8f8 Implement lazy allocation of data for complex escher properties
This may reduce memory usage if the content is never used
or not populated for some reason.

This should fix https://issues.oss-fuzz.com/issues/42528528
2026-01-10 13:14:34 +01:00
Dominik Stadler
ddf71d0984 Avoid two NPEs which were currently "expected" in tests
When things go wrong, we always want to give an
explanation via an exception instead of an NPE.
2026-01-06 22:47:00 +01:00
Dominik Stadler
9e1afbbab1 Fix some more Gradle deprecation-warnings in preparation for Gradle 9
Only signing-handling in poi-ooxml is still remaining, but
this deprecation seems to have been moved to Gradle 10 anyway.

Gradle 9 will require JDK 17, though, so we can only upgrade
when the min. supported JDK is bumped once more.
2025-12-19 16:15:21 +01:00
Dominik Stadler
97a97bd75c JavaDoc: Don't link to classes from "poi-ooxml" in module "poi"
Otherwise building javadoc in CI fails sometimes, maybe if
the repository is cleaned before building.

And add some missing javadoc
2025-12-17 22:12:41 +01:00
Dominik Stadler
338882ac88 Convert some files to unix newlines
Otherwise these can cause issues when checking out
sources on Windows
2025-12-17 22:11:29 +01:00
PJ Fanning
e7620b7ce7 set up default impls of new(-ish) methods 2025-12-05 10:58:48 +01:00
PJ Fanning
6d6089eee5
nullSafeFormatProperties (#961) 2025-12-05 10:51:57 +01:00
Dominik Stadler
236784371b Update JavaDoc-references to JDK 11 2025-12-03 21:35:02 +01:00
Dominik Stadler
2805093da6 Add missing Mockito which is needed for module-based execution of tests
This seems to only fail in Ant-based test-execution
2025-12-02 19:47:08 +01:00
vo0ff
006e49765c
Bugzilla 69303: Fix RangeCopier's copyMergedRanges when copying withing the same sheet (#958)
* Bugzilla 69303: added failing test for case with same sheet RangeCopier for merged regions

* Bugzilla 69303: fixed same sheet issue when enabling copy of merged ranges

* Bugzilla 69303: added @since 6.0.0 to new public methods

---------

Co-authored-by: Viktor Ozerov <vik.ozerov+git@gmail.com>
2025-12-01 22:38:04 +01:00
PJ Fanning
f44ece137f adjust 'since' values to remove POI 2025-12-01 19:28:56 +01:00
PJ Fanning
32d7a45b50 license headers 2025-11-26 13:39:37 +01:00
PJ Fanning
fa95a3e522
reduce use of setCellType (#943) 2025-11-19 14:20:56 +01:00
PJ Fanning
540f0e5617
remove deprecated hasOOXMLHeader method (#941) 2025-11-19 13:58:41 +01:00
PJ Fanning
9fb2c4b03e
make getCachedResultType return enum (#939) 2025-11-19 13:58:18 +01:00
PJ Fanning
cb520e8046
remove deprecated getCodepoints method (#940) 2025-11-19 13:58:03 +01:00
Dominik Stadler
b770a35aba Add missing @Deprecated and @Removal 2025-11-16 22:34:18 +01:00
Dominik Stadler
59e595b844 Remove some of the deprecated methods with @Removal("6.0.0")
We announced their removal for 6.0.0, so
we can remove them now as we plan a 6.0.0 release
next.

Some were not yet removed as they have still internal
usage or seem to need more work to finally remove.
2025-11-16 22:34:18 +01:00
Dominik Stadler
c6a621edc6 Remove deprecated methods with @Removal("5...")
We announced their removal already for 5.0.0 or 5.3.0, so
we can safely remove them now as we plan a 6.0.0 release
next.

Cell.setCellType() needs a closer look later as
it is not a simple deletion of code.
2025-11-16 22:34:18 +01:00
Dominik Stadler
cd22293975 Newer Mockito prevents using code from org.mockito.internal.matchers
At least locally tests fail now for me, so let's get rid of using
internal code here.
2025-11-16 14:18:06 +01:00
Dominik Stadler
d486e50822 Use OpenRewrite to update code to make use of Java 11 2025-11-16 14:18:06 +01:00
PJ Fanning
16ecbc7d48 build issues 2025-11-15 11:34:52 +01:00
PJ Fanning
323b5c8c6b start move to require java 11 min 2025-11-15 11:26:19 +01:00
Dominik Stadler
b16a094bba Fix JavaDoc
Otherwise javadoc generation fails locally
2025-11-03 07:31:41 +01:00
Dominik Stadler
a371cba0be Apply IDE suggestions 2025-11-03 07:31:41 +01:00
PJ Fanning
e09a167bbb javadoc 2025-11-02 09:32:40 +01:00
PJ Fanning
f632c29683 javadoc issue 2025-10-31 00:18:10 +00:00
PJ Fanning
0dc32a8596
cache CellStyle Properties to improve performance (#926)
* cache CellStyle Properties to improve performance

* add tests
2025-10-29 19:47:21 +00:00
Dominik Stadler
dc2cfe0bfc Apply IDE suggestions 2025-10-06 07:40:53 +02:00
PJ Fanning
05f37a5204 refactor SheetUtil code 2025-09-30 10:03:39 +01:00
Jaroslav Tulach
0a17fa9e22
Delay initialization of fontRenderContext field & co. by moving it into own inner class (#909)
* git-svn-id: https://svn.apache.org/repos/asf/poi/tags/REL_5_2_3@1904113 13f79535-47bb-0310-9956-ffa450edef68

* Delay loading AWT classes by moving the methods into own class

* Set default value of ignoreMissingFontSystem to true when java.desktop module isn't available

---------

Co-authored-by: PJ Fanning <fanningpj@apache.org>
Co-authored-by: Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2025-09-30 09:44:47 +01:00
PJ Fanning
03fc1ddea1 [github-911] close DataSource before deleting temp file 2025-09-26 19:22:32 +01:00
PJ Fanning
49fd564023
log4j bom (#897) 2025-09-11 10:52:01 +01:00
PJ Fanning
d0e6830e44
issue when formatting number when divisor is needed (#895)
* reproduce issue 69812

* workaround for issue
2025-09-09 22:27:48 +01:00
PJ Fanning
aeb53ffe62 Create TestHSSFParser.java 2025-08-28 16:38:58 +01:00
PJ Fanning
9f9ff14e56 add test 2025-08-28 13:00:54 +01:00
PJ Fanning
c38f5f9577
Reorder import statements in TestHSSFColor 2025-08-27 15:47:49 +01:00
PJ Fanning
061d6a3d0f more parsers 2025-08-20 18:34:48 +01:00