From 2c06688d579df05019d7b418d561c42046bb5e66 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Wed, 12 Apr 2023 11:08:02 +0300 Subject: [PATCH] Skip WINDOW2 validation when reading possibly non-compliant XLS --- main/HSSF/Model/RecordOrderer.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/HSSF/Model/RecordOrderer.cs b/main/HSSF/Model/RecordOrderer.cs index ce55411a0..fbf825966 100644 --- a/main/HSSF/Model/RecordOrderer.cs +++ b/main/HSSF/Model/RecordOrderer.cs @@ -434,8 +434,9 @@ public static bool IsEndOfRowBlock(int sid) case DVALRecord.sid: return true; case EOFRecord.sid: - // WINDOW2 should always be present, so shouldn't have got this far - throw new InvalidOperationException("Found EOFRecord before WindowTwoRecord was encountered"); + // WINDOW2 should always be present, but there can be files that are non-compliant to spec + // which are automatically fixed when saved again using Excel, so ignoring the problem when reading + return true; } return PageSettingsBlock.IsComponentRecord(sid); }