From 6382b082bad1b5319a792a7def5ccee1180dfdbc Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Fri, 15 Jul 2022 09:25:11 +0200 Subject: [PATCH] Aktiver Bereich korrigiert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die aktiven Zellen, d.h. die zu vergleichenden wurden nicht zuverlässig erkannt. Ich habe daher eine andere Funktion verwendet, die ich auf Stackoverflow gefunden habe. Ganz 100% sicher bin ich allerdings nicht, ob dieser Quatsch in jeder Situation zufriedenstellend funktioniert. --- ENI2/Excel/ExcelComparer.cs | 9 +++++++++ ENI2/Excel/ExcelUtil.cs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/ENI2/Excel/ExcelComparer.cs b/ENI2/Excel/ExcelComparer.cs index 99eea7e0..4fa1138d 100644 --- a/ENI2/Excel/ExcelComparer.cs +++ b/ENI2/Excel/ExcelComparer.cs @@ -27,11 +27,20 @@ namespace ENI2.Excel { try { + sheet.Columns.ClearFormats(); + sheet.Rows.ClearFormats(); + Range usedRange = sheet.UsedRange; + lastUsedRow = usedRange.Rows.Count; + lastUsedColumn = usedRange.Columns.Count; + + /* Range last = sheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing); Range range = sheet.get_Range("A1", last); lastUsedRow = last.Row; lastUsedColumn = last.Column; + */ + return true; } catch(Exception) diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index 0e30232a..c2a4d28e 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -982,6 +982,9 @@ namespace ENI2.Excel } } + if (!stat.Flag.IsNullOrEmpty()) stat.Flag = stat.Flag.ToUpper(); + if (!stat.PortOfRegistry.IsNullOrEmpty()) stat.PortOfRegistry = stat.PortOfRegistry.ToUpper(); + stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber"); stat.CallSign = reader.ReadTextNoWhitespace("STAT.CallSign"); stat.ISMCompanyId = reader.ReadTextNoWhitespace("STAT.ISMCompanyId");