Aktiver Bereich korrigiert

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.
This commit is contained in:
Daniel Schick 2022-07-15 09:25:11 +02:00
parent 6138c99ba9
commit 6382b082ba
2 changed files with 12 additions and 0 deletions

View File

@ -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)

View File

@ -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");