Commit Graph

44 Commits

Author SHA1 Message Date
Marten Deinum
cc72e8d616 Fix IsoFormattingDateDataFormatter
The format used the ISO_OFFSET_DATE_TIME is the wrong one and leads to errors
formatting the date. Instead we should have used the ISO_LOCAL_DATE_TIME instead.

This commit fixes that and also includes a bug fix for the XLSX variant as that didn't
use the overridden method. The correct method for this has been overridden now also
formatting the dates/times for that using the ISO_LOCAL_DATE_TIME format.

Tests for different types have been added as well, as to make sure this
keeps working for newer versions.

Closes: #121
2024-08-07 14:11:52 +02:00
Marten Deinum
b6e2b97068 Consistently open workbook in readonly mode
The itemreaders provided by this project are reading only. So it makes
sense to open them with only read-only priviliges. We already did this
for the streaming version of the itemreader. With this commit we also
enable this for the regular itemreader.

Closes: #128
2024-08-07 13:04:42 +02:00
Marten Deinum
ce21f2f529 Upgrade to Java17
Closes: #130
2024-08-07 11:44:15 +02:00
Marten Deinum
38ce224502 Prefer ArrayList over LinkedList (#118)
Both the ArrayList and LinkedList keep the order
of insertion, there is no need to use the LinkedList.
2023-10-02 16:18:54 +02:00
Marten Deinum
f9709d9c35 Allow a Locale to be set for formatting (#100)
The internal DataFormatter used from Apache POI allows for setting a fixed
Locale to use when reading numbers, dates etc. Initially we didn't set this
and thus it always used the default Locale as set from the Java runtime. This
could lead to unexpected results. We now allow to set the userLocale property
and use this to configure the DataFormatter used internally.

We also took the opportunity to make this work with the streaming ItemReader
as well as the regular ItemReader. The streaming item reader now also uses
a pre-configured DataFormatter.

Closes: #98
2023-09-19 20:48:29 +02:00
Marten Deinum
700e3bfe15 Remove now obsolete log4j2.xml 2022-12-06 14:08:38 +01:00
Marten Deinum
7820d8ea6a Optional iso dates (#94)
* Optionally use ISO formatting for dates

Prior to this commit we always used the date pattern as
assigned in the Excel workbook for the cell. Which could
lead to surprising results.

We now allow the dates to be formatted as an ISO date time with
offset, so dates/times are consistently formatted in the result.

Closes: #88
2022-04-12 10:58:18 +02:00
Marten Deinum
f22212b70b Improve resource file check (#90)
With this commit we use the isFile check introduced in
Spring 5 to check if something is an actaul file resource
instead of relying on FileNotFoundException.

Resource implementations didn't consistently throw a
FileNotFoundException (like the Google Big Query one)
leading to issues with reading.

Closes: 89
2022-02-03 08:29:48 +01:00
Marten Deinum
6471d899b5 Polish testing
Enabled junit5 testing in Maven (upgrade plugin) and added
additional tests to the Streaming and XLSX reader.
2021-12-07 09:48:49 +01:00
Marten Deinum
3f81bdb75c Polish 2021-12-07 09:29:31 +01:00
César Alves
b378ac1dfd Move to next sheet when there are only empty/invalid rows (#82)
When there are blank or empty lines in the end of one sheet, null is returned by doRead without trying to read next sheet. A recursive call makes sheet moving happen when another exists.

Co-authored-by: Mahmoud Ben Hassine <mbenhassine@vmware.com>
Co-authored-by: cesar.alves@gmail.com <coa@pc-coa.caso.pt>
2021-12-07 09:27:46 +01:00
Marten Deinum
9bb5c79290 Initial version 0.1.0 changes from original repository
Development of Spring Batch Excel continued in the original repository at
http://github.com/mdeinum/spring-batch-excel.git, with this commit we transfer all fixes, updates and new features in one go to the Spring Batch Excel repository.

The most important changes are:
- Moved to new location org.springframework.batch.extensions
- Removed support for JXL
- Initial support for reading XLSX files streaming
- Upgraded dependencies to most recent versions
- Support for reading password protected files
- Numerous small fixes

Fixes: 10,11,19,26,29,34
Closes: 13,14,30,35,50
2021-03-26 16:53:54 +01:00
Spring Operator
288b63e6de URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 33 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-25 14:55:22 +01:00
Marten Deinum
6e6f2dc703 polish
Numeric type can contain a Date instead of a number, check
added for Date and return the time in millis if a Date is found.
2015-03-13 09:49:01 -05:00
Marten Deinum
534c5b31df Replace BeanPropertyRowMapper with BeanWrapperRowMapper.
Use the BeanWrapper to bind values to beans. Based on the BeanWrapperFieldSetMapper.
2015-03-13 09:49:01 -05:00
Marten Deinum
371474fb48 polish
Cache FormulaEvaluator instead of creating a new one.
2015-03-13 09:49:01 -05:00
Marten Deinum
0f513faa91 polish javadoc
Fixed typo
2015-03-13 09:49:00 -05:00
Marten Deinum
58bbaa494d polish
inline numberOfRows, numberOfColumns and the name for performance.
2015-03-13 09:49:00 -05:00
Marten Deinum
01ae4985e4 Javadoc
Added package-info files.
2015-03-13 09:49:00 -05:00
Marten Deinum
b945428eaf Javadoc
Fixed javadoc errors and warnings
2015-03-13 09:49:00 -05:00
Marten Deinum
3cdce1f9ef Javadoc
Remove <p> and </p> where they didn't match.
2015-03-13 09:49:00 -05:00
Marten Deinum
30ff7bb1cd Cleanup of close methods.
Removed the doCloseWorkbook method in favor of the normal doClose method.

The PoiItemReader now closes the InputStream and Workbook (for Apache POI >= 3.11)
2015-03-13 09:48:59 -05:00
Marten Deinum
8fc7058bc2 Deprecate JExcelAPI usage
Deprecated since JExcelAPI is an abandoned project (no release since 2009, with serious bugs remaining)
2015-03-13 09:48:59 -05:00
Marten Deinum
67cf9b738f Fix imports. 2015-03-13 09:48:58 -05:00
Marten Deinum
71a1babf98 polish javadoc 2015-03-13 09:48:58 -05:00
Marten Deinum
080f1a8318 polish
Remove javadoc reference to JExcelAPI.
Removed unused private method.
2015-03-13 09:48:57 -05:00
Marten Deinum
f05a429c16 Improve RowSet abstraction.
Extracted a ColumnNameExtractor to be able to remove
some logic from the sheet.

Increased tests for reading excel files including mapping to
objects.
2015-03-13 09:48:57 -05:00
Marten Deinum
5a4aa5d533 Introduce RowSet abstraction. 2015-03-13 09:48:56 -05:00
Marten Deinum
f486e83eb8 Revert "Introduce support package"
This reverts commit 8b017871c62258dfba884cb92e82cbb6532fa158.
2015-03-13 09:48:56 -05:00
Marten Deinum
ee94ef1fdc Introduce support package 2015-03-13 09:48:56 -05:00
Marten Deinum
9f26c52f7a Test result read.
Fixed bug in PoiItemReader/PoiSheet which lead to ignoring empty columns.
2015-03-13 09:48:56 -05:00
Marten Deinum
d799fdd561 Moved setting of flag to after the file has been succesfully opened. 2015-03-13 09:48:55 -05:00
Marten Deinum
956af71f2e Updated copyright notices
Aligned versions in java and pom
2015-03-13 09:48:55 -05:00
Marten Deinum
de0b2e7f57 Removed unnecessary getter. 2015-03-13 09:48:55 -05:00
Marten Deinum
a5a48c6983 Updated javadoc. 2015-03-13 09:48:54 -05:00
Marten Deinum
6c4f0414c3 Fixed potential NullPointer. 2015-03-13 09:48:54 -05:00
Marten Deinum
4e58b855e6 Updated javadoc. 2015-03-13 09:48:54 -05:00
Marten Deinum
6ecdb26fe5 Fixed typo in test message. 2015-03-13 09:48:53 -05:00
Marten Deinum
24e9166fff Added @Override annotations. 2015-03-13 09:48:53 -05:00
Marten Deinum
85dab9d0eb Added support for evaluating formulas. 2015-03-13 09:48:53 -05:00
Marten Deinum
e08b7103d9 Updated Copyright notices. 2015-03-13 09:48:53 -05:00
Marten Deinum
0027f9b2e1 Changed pom version and @since tags with classes to match the pom version. 2015-03-13 09:48:52 -05:00
Marten Deinum
3f89cb5869 Added readme. 2015-03-13 09:48:52 -05:00
Marten Deinum
bec581912f Update to POI 3.10-FINAL. 2015-03-13 09:48:52 -05:00