Skip to content

Commit

Permalink
Open File in readExcel in read-only mode
Browse files Browse the repository at this point in the history
WorkBook is used for reading, so it generally makes sense. It should fix the following error:
OpenXML4JRuntimeException: Fail to save an error occurs while saving the package: The part/docProps/app.ant failed to be saved in the stream marshaller org.apache.pos.openxml4j
  • Loading branch information
koperagen committed Oct 22, 2024
1 parent b3b1f64 commit 4ffb019
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ public fun DataFrame.Companion.readExcel(
nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE,
): AnyFrame {
setWorkbookTempDirectory()
val wb = WorkbookFactory.create(file)
@Suppress("ktlint:standard:comment-wrapping")
val wb = WorkbookFactory.create(file, /* password = */ null, /* readOnly = */ true)
return wb.use {
readExcel(it, sheetName, skipRows, columns, stringColumns?.toFormattingOptions(), rowsCount, nameRepairStrategy)
}
Expand Down

0 comments on commit 4ffb019

Please sign in to comment.