Removed the rest of Excel.Interop references

This commit is contained in:
Daniel Schick 2025-10-06 11:24:00 +02:00
parent 76a8d33c2a
commit bc64b14e34
10 changed files with 379 additions and 319 deletions

View File

@ -12,7 +12,7 @@
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup> </startup>
<applicationSettings> <applicationSettings>
<ENI2.Properties.Settings> <ENI2.Properties.Settings>
@ -127,6 +127,18 @@
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" /> <bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DocumentFormat.OpenXml.Framework" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.HashCode" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

View File

@ -11,13 +11,10 @@ using log4net;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System; using System;
using System.Net;
using ENI2.LockingServiceReference; using ENI2.LockingServiceReference;
using ENI2.Util; using ENI2.Util;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
using System.Drawing.Drawing2D;
namespace ENI2 namespace ENI2
{ {

View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ENI2</RootNamespace> <RootNamespace>ENI2</RootNamespace>
<AssemblyName>ENI2Test</AssemblyName> <AssemblyName>ENI2Test</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -140,11 +140,11 @@
<Reference Include="ClosedXML.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d5f7376574c51ec, processorArchitecture=MSIL"> <Reference Include="ClosedXML.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d5f7376574c51ec, processorArchitecture=MSIL">
<HintPath>packages\ClosedXML.Parser.2.0.0\lib\netstandard2.0\ClosedXML.Parser.dll</HintPath> <HintPath>packages\ClosedXML.Parser.2.0.0\lib\netstandard2.0\ClosedXML.Parser.dll</HintPath>
</Reference> </Reference>
<Reference Include="DocumentFormat.OpenXml, Version=3.1.1.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL"> <Reference Include="DocumentFormat.OpenXml, Version=3.3.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>packages\DocumentFormat.OpenXml.3.1.1\lib\net46\DocumentFormat.OpenXml.dll</HintPath> <HintPath>packages\DocumentFormat.OpenXml.3.3.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
</Reference> </Reference>
<Reference Include="DocumentFormat.OpenXml.Framework, Version=3.1.1.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL"> <Reference Include="DocumentFormat.OpenXml.Framework, Version=3.3.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>packages\DocumentFormat.OpenXml.Framework.3.1.1\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath> <HintPath>packages\DocumentFormat.OpenXml.Framework.3.3.0\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL"> <Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
<HintPath>packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath> <HintPath>packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath>
@ -158,8 +158,8 @@
<Reference Include="Microsoft.Bcl.Cryptography, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="Microsoft.Bcl.Cryptography, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.Cryptography.9.0.9\lib\net462\Microsoft.Bcl.Cryptography.dll</HintPath> <HintPath>packages\Microsoft.Bcl.Cryptography.9.0.9\lib\net462\Microsoft.Bcl.Cryptography.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="Microsoft.Bcl.HashCode, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath> <HintPath>packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <Reference Include="Microsoft.Extensions.DependencyInjection, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.DependencyInjection.9.0.9\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath> <HintPath>packages\Microsoft.Extensions.DependencyInjection.9.0.9\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
@ -179,10 +179,6 @@
<Reference Include="Microsoft.Extensions.Primitives, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <Reference Include="Microsoft.Extensions.Primitives, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Primitives.9.0.9\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath> <HintPath>packages\Microsoft.Extensions.Primitives.9.0.9\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="MigraDoc.DocumentObjectModel, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL"> <Reference Include="MigraDoc.DocumentObjectModel, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll</HintPath> <HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll</HintPath>
</Reference> </Reference>

View File

@ -1,13 +1,14 @@
// Copyright (c) 2017-today Informatikbüro Daniel Schick // Copyright (c) 2017-today Informatikbüro Daniel Schick
// Base class excel (writer not yet implemented but eventually..) // Base class excel access (named ranges, colorizing, etc.)
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Office.Interop.Excel; using ClosedXML.Excel;
using System.Runtime.InteropServices;
using log4net; using log4net;
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Drawing;
using System.Linq;
namespace ENI2.Excel namespace ENI2.Excel
{ {
@ -20,10 +21,8 @@ namespace ENI2.Excel
protected CountryMode _countryMode = CountryMode.DE; protected CountryMode _countryMode = CountryMode.DE;
protected Workbooks _excelWorkbooks; protected XLWorkbook _workBook;
protected Workbook _workBook; protected Dictionary<string, IXLDefinedName> _nameDict;
protected Application _excelApp;
protected Dictionary<string, Name> _nameDict;
protected ILog _log; protected ILog _log;
#endregion Fields #endregion Fields
@ -32,12 +31,7 @@ namespace ENI2.Excel
public ExcelBase() public ExcelBase()
{ {
_log = LogManager.GetLogger(this.GetType().Name); _log = LogManager.GetLogger(this.GetType().Name);
this._excelApp = new Application();
this._excelApp.DisplayAlerts = false;
this._excelWorkbooks = _excelApp.Workbooks;
} }
#endregion Construction #endregion Construction
@ -46,9 +40,9 @@ namespace ENI2.Excel
internal CountryMode Mode { get { return _countryMode; } } internal CountryMode Mode { get { return _countryMode; } }
internal Dictionary<string, Name> NameDict { get { return _nameDict; } } internal Dictionary<string, IXLDefinedName> NameDict { get { return _nameDict; } }
internal Sheets Worksheets { get { return _workBook.Worksheets; } } internal IXLWorksheets Worksheets { get { return _workBook?.Worksheets; } }
#endregion #endregion
@ -56,17 +50,17 @@ namespace ENI2.Excel
protected void InitNameFields() protected void InitNameFields()
{ {
_nameDict = new Dictionary<string, Name>(); _nameDict = new Dictionary<string, IXLDefinedName>();
int bookCnt = 0; int bookCnt = 0;
foreach (Name name in _workBook.Names)
{
string theValue = name.Value;
// Namensbezug: =SheetZelle. Leere Referenzen überspringen (kommt immer mal wieder vor!)
string nameKey = name.Name; // Get workbook-level defined names
foreach (var definedName in _workBook.DefinedNames)
{
string nameKey = definedName.Name;
try try
{ {
// Handle sheet-scoped names (Sheet1!Name format)
if (nameKey.Contains("!")) if (nameKey.Contains("!"))
nameKey = nameKey.Substring(nameKey.IndexOf('!') + 1); nameKey = nameKey.Substring(nameKey.IndexOf('!') + 1);
} }
@ -76,33 +70,34 @@ namespace ENI2.Excel
continue; continue;
} }
if ((theValue != "=#REF!#REF!") && (theValue != "=#BEZUG!#BEZUG!")) // Check if the defined name is valid (not a broken reference)
if (definedName.IsValid)
{ {
_nameDict[nameKey] = name; _nameDict[nameKey] = definedName;
bookCnt++; bookCnt++;
} }
} }
_log.DebugFormat("{0} named ranges found at Workbook level", bookCnt); _log.DebugFormat("{0} defined names found at Workbook level", bookCnt);
// Get worksheet-level defined names
foreach (Worksheet ws in _workBook.Worksheets) foreach (var ws in _workBook.Worksheets)
{ {
int wsCnt = 0; int wsCnt = 0;
foreach (Name name in ws.Names) foreach (var definedName in ws.DefinedNames)
{ {
string theValue = name.Value; string nameKey = definedName.Name;
// Namensbezug: =SheetZelle. Leere Referenzen überspringen (kommt immer mal wieder vor!)
if (!_nameDict.ContainsKey(name.Name)) if (!_nameDict.ContainsKey(nameKey))
{ {
if ((theValue != "=#REF!#REF!") && (theValue != "=#BEZUG!#BEZUG!")) if (definedName.IsValid)
{ {
_nameDict[name.Name] = name; _nameDict[nameKey] = definedName;
wsCnt++; wsCnt++;
} }
} }
} }
if (wsCnt > 0) if (wsCnt > 0)
_log.DebugFormat("{0} named ranges found in Worksheet {1}", wsCnt, ws.Name); _log.DebugFormat("{0} defined names found in Worksheet {1}", wsCnt, ws.Name);
} }
} }
@ -127,27 +122,40 @@ namespace ENI2.Excel
{ {
if (_nameDict.ContainsKey(lookup)) if (_nameDict.ContainsKey(lookup))
{ {
var val = _nameDict[lookup].RefersToRange.Value; var definedName = _nameDict[lookup];
if (val is double) result = val; var ranges = definedName.Ranges;
if ((val is string) && (val.Length > 0)) var range = ranges.FirstOrDefault();
{
result = ParseAnyDouble(val);
if(result == null) if (range != null)
{
var cell = range.FirstCell();
if (cell != null)
{ {
Match m = Regex.Match(val, "([0-9\\.\\,]+)([a-zA-Z]*)"); var cellValue = cell.Value;
if (m.Success)
if (cellValue.IsNumber)
{ {
result = ParseAnyDouble(m.Groups[1].Value); result = cellValue.GetNumber();
}
else if (cellValue.IsText)
{
string textVal = cellValue.GetText();
if (!string.IsNullOrEmpty(textVal))
{
result = ParseAnyDouble(textVal);
if (result == null)
{
Match m = Regex.Match(textVal, "([0-9\\.\\,]+)([a-zA-Z]*)");
if (m.Success)
{
result = ParseAnyDouble(m.Groups[1].Value);
}
}
}
} }
} }
} }
if ((result == null) && (val != null))
{
double tmpDouble2 = val[1, 1];
result = tmpDouble2;
}
} }
} }
catch (Exception) catch (Exception)
@ -159,17 +167,26 @@ namespace ENI2.Excel
internal void Colorize(string lookup, int color) internal void Colorize(string lookup, int color)
{ {
if(_nameDict.ContainsKey(lookup)) if (_nameDict.ContainsKey(lookup))
{ {
var range = _nameDict[lookup].RefersToRange; var definedName = _nameDict[lookup];
Colorize(range, color); var ranges = definedName.Ranges;
var range = ranges.FirstOrDefault();
if (range != null)
{
Colorize(range, color);
}
} }
} }
internal void Colorize(Range range, int color) internal void Colorize(IXLRange range, int color)
{ {
range.Interior.Color = color; // Convert int color to Color object
range.Worksheet.Tab.Color = color; Color backgroundColor = Color.FromArgb(color);
range.Style.Fill.BackgroundColor = XLColor.FromColor(backgroundColor);
// Set worksheet tab color
range.Worksheet.SetTabColor(XLColor.FromColor(backgroundColor));
} }
#endregion #endregion
@ -178,9 +195,7 @@ namespace ENI2.Excel
public void Save(string path) public void Save(string path)
{ {
this._workBook.SaveAs(path, XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, _workBook.SaveAs(path);
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
this._workBook.Saved = true;
} }
#endregion #endregion
@ -191,29 +206,16 @@ namespace ENI2.Excel
{ {
try try
{ {
if (this._workBook != null) if (_workBook != null)
{ {
this._workBook.Close(0); _log.Debug("Disposing Workbook");
_log.Debug("Close Worksheet"); _workBook.Dispose();
Marshal.ReleaseComObject(this._workBook); _workBook = null;
}
if (this._excelWorkbooks != null)
{
this._excelWorkbooks.Close();
_log.Debug("Close Workbooks");
Marshal.ReleaseComObject(this._excelWorkbooks);
}
if (this._excelApp != null)
{
_log.Debug("Quit Excel");
this._excelApp.Quit();
Marshal.ReleaseComObject(this._excelApp);
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
_log.ErrorFormat("Exception disposing ExcelReader: {0}", ex.Message); _log.ErrorFormat("Exception disposing ExcelBase: {0}", ex.Message);
} }
} }

View File

@ -9,13 +9,12 @@
using bsmd.database; using bsmd.database;
using ENI2.Locode; using ENI2.Locode;
using Microsoft.Office.Interop.Excel; using ClosedXML.Excel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
namespace ENI2.Excel namespace ENI2.Excel
{ {
@ -31,9 +30,9 @@ namespace ENI2.Excel
internal Dictionary<string, string> ImportValues { get; } = new Dictionary<string, string>(); internal Dictionary<string, string> ImportValues { get; } = new Dictionary<string, string>();
public ExcelReader(string filePath, bool openReadonly = true, bool createNameFields = true) public ExcelReader(string filePath, bool createNameFields = true)
{ {
this._workBook = _excelWorkbooks.Open(filePath, 0, openReadonly, 5, "", "", false, XlPlatform.xlWindows, "", false, false, 0, false, false, false); this._workBook = new XLWorkbook(filePath);
if (createNameFields) if (createNameFields)
this.InitNameFields(); this.InitNameFields();
@ -69,16 +68,20 @@ namespace ENI2.Excel
{ {
try try
{ {
var val = _nameDict[lookup].RefersToRange.Value; var definedName = _nameDict[lookup];
var val2 = _nameDict[lookup].RefersToRange.Value2; var range = definedName.Ranges.FirstOrDefault();
if (val != null) if (range != null)
result = val.ToString().Trim(); {
else if (val2 != null) var cell = range.FirstCell();
result = val2.ToString().Trim(); if (cell != null && !cell.Value.IsBlank)
{
result = cell.Value.ToString().Trim();
}
}
} }
catch (COMException ex) catch (Exception ex)
{ {
_log.WarnFormat("COMException reading field {0}: {1}", lookup, ex.ErrorCode); _log.WarnFormat("Exception reading field {0}: {1}", lookup, ex.Message);
} }
} }
if (result != null) if (result != null)
@ -441,47 +444,61 @@ namespace ENI2.Excel
if (_nameDict.ContainsKey(lookup)) if (_nameDict.ContainsKey(lookup))
{ {
var val = _nameDict[lookup].RefersToRange.Value; var definedName = _nameDict[lookup];
if (val is DateTime) var range = definedName.Ranges.FirstOrDefault();
if (range != null)
{ {
date = val; var cell = range.FirstCell();
} if (cell != null && !cell.Value.IsBlank)
else if (val is double)
{
try
{ {
date = DateTime.FromOADate(val); var cellValue = cell.Value;
if (cellValue.IsDateTime)
{
date = cellValue.GetDateTime();
}
else if (cellValue.IsNumber)
{
double numValue = 0;
try
{
numValue = cellValue.GetNumber();
date = DateTime.FromOADate(numValue);
}
catch (ArgumentException) { /* .. */ }
if (date == null)
{
CultureInfo provider = CultureInfo.InvariantCulture;
string dateString = numValue.ToString();
const string format = "yyyyMMdd";
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
date = tmpDate;
}
}
else if (cellValue.IsText)
{
string textValue = cellValue.GetText();
if (DateTime.TryParse(textValue, out DateTime tmpDate))
date = tmpDate;
if (date == null)
{
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
if (DateTime.TryParseExact(textValue, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate2))
date = tmpDate2;
}
if (date == null)
{
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
if (DateTime.TryParseExact(textValue, formats, en, DateTimeStyles.None, out DateTime tmpDate3))
date = tmpDate3;
}
}
} }
catch (ArgumentException) { /* .. */ }
if (date == null)
{
CultureInfo provider = CultureInfo.InvariantCulture;
string dateString = val.ToString();
const string format = "yyyyMMdd";
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
date = tmpDate;
}
}
if (date == null)
{
if (DateTime.TryParse(val, out DateTime tmpDate))
date = tmpDate;
}
if (date == null)
{
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
if (DateTime.TryParseExact(val, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
date = tmpDate;
}
if (date == null)
{
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
if (DateTime.TryParseExact(val, formats, en, DateTimeStyles.None, out DateTime tmpDate))
return tmpDate;
} }
if (date != null) if (date != null)
@ -532,61 +549,67 @@ namespace ENI2.Excel
{ {
if (_nameDict.ContainsKey(lookup)) if (_nameDict.ContainsKey(lookup))
{ {
var val = _nameDict[lookup].RefersToRange.Value; var definedName = _nameDict[lookup];
if (val is DateTime) var range = definedName.Ranges.FirstOrDefault();
if (range != null)
{ {
result = val; var cell = range.FirstCell();
} if (cell != null && !cell.Value.IsBlank)
if (val is double)
{
try
{ {
result = DateTime.FromOADate(val); var cellValue = cell.Value;
}
catch (ArgumentException) { }
if (result == null) if (cellValue.IsDateTime)
{
CultureInfo provider = CultureInfo.InvariantCulture;
string dateString = val.ToString();
if (!dateString.Contains(":"))
{ {
const string format = "HHmm"; result = cellValue.GetDateTime();
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
result = tmpDate;
} }
} else if (cellValue.IsNumber)
} {
double numValue = 0;
try
{
numValue = cellValue.GetNumber();
result = DateTime.FromOADate(numValue);
}
catch (ArgumentException) { }
if (val is string @string) if (result == null)
{ {
if (@string.EndsWith("lt", StringComparison.OrdinalIgnoreCase)) CultureInfo provider = CultureInfo.InvariantCulture;
val = @string.Substring(0, @string.Length - 2).Trim(); string dateString = numValue.ToString();
else if (!dateString.Contains(":"))
val = @string.Trim(); {
} const string format = "HHmm";
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
result = tmpDate;
}
}
}
else if (cellValue.IsText)
{
string textValue = cellValue.GetText();
if (result == null) if (textValue.EndsWith("lt", StringComparison.OrdinalIgnoreCase))
{ textValue = textValue.Substring(0, textValue.Length - 2).Trim();
if (DateTime.TryParseExact(val, "HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date)) else
result = date; textValue = textValue.Trim();
}
if (result == null) if (DateTime.TryParseExact(textValue, "HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date))
{ result = date;
if (DateTime.TryParseExact(val, "HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date))
result = date;
}
if ((result == null) && (val != null)) if (result == null)
{ {
CultureInfo provider = CultureInfo.InvariantCulture; if (DateTime.TryParseExact(textValue, "HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date2))
string dateString = val.ToString(); result = date2;
if (!dateString.Contains(":")) }
{
const string format = "HHmm"; if (result == null && !textValue.Contains(":"))
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate)) {
result = tmpDate; CultureInfo provider = CultureInfo.InvariantCulture;
const string format = "HHmm";
if (DateTime.TryParseExact(textValue, format, provider, DateTimeStyles.None, out DateTime tmpDate))
result = tmpDate;
}
}
} }
} }
} }
@ -627,7 +650,7 @@ namespace ENI2.Excel
{ {
try try
{ {
Worksheet theWorkSheet = _workBook.Worksheets[sheetName]; var theWorkSheet = _workBook.Worksheets.Worksheet(sheetName);
return theWorkSheet != null; return theWorkSheet != null;
} }
catch (Exception) catch (Exception)
@ -640,12 +663,13 @@ namespace ENI2.Excel
{ {
try try
{ {
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName]; var workSheet = _workBook.Worksheets.Worksheet(sheetName);
string result = workSheet.Range[range].Text.ToString(); var cell = workSheet.Range(range).FirstCell();
string result = cell.Value.ToString();
if (!result.IsNullOrEmpty()) if (!result.IsNullOrEmpty())
{ {
result = result.Trim().Clean(); result = result.Trim().Clean();
if(maxLength.HasValue && result.Length > maxLength.Value) if (maxLength.HasValue && result.Length > maxLength.Value)
{ {
result = result.Substring(0, maxLength.Value); result = result.Substring(0, maxLength.Value);
} }
@ -663,8 +687,9 @@ namespace ENI2.Excel
{ {
try try
{ {
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName]; var workSheet = _workBook.Worksheets.Worksheet(sheetName);
string result = workSheet.Range[row, col].Text.ToString(); var cell = workSheet.Cell(row, col);
string result = cell.Value.ToString();
if (!result.IsNullOrEmpty()) if (!result.IsNullOrEmpty())
result = result.Trim().Clean(); result = result.Trim().Clean();
return result; return result;
@ -681,10 +706,11 @@ namespace ENI2.Excel
{ {
try try
{ {
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName]; var workSheet = _workBook.Worksheets.Worksheet(sheetName);
Range aRange = workSheet.Range[range]; var aRange = workSheet.Range(range);
if (aRange != null) if (aRange != null)
{ {
// TODO: Implement dropdown reading logic for ClosedXML
} }
} }
catch (Exception e) catch (Exception e)
@ -713,26 +739,27 @@ namespace ENI2.Excel
try try
{ {
double? result = null; double? result = null;
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName]; var workSheet = _workBook.Worksheets.Worksheet(sheetName);
var val = workSheet.Range[range].Value; var cell = workSheet.Range(range).FirstCell();
if (val is double) result = val; var cellValue = cell.Value;
if (val is string)
if (cellValue.IsNumber)
{ {
if (double.TryParse(val, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, result = cellValue.GetNumber();
}
else if (cellValue.IsText)
{
string textValue = cellValue.GetText();
if (double.TryParse(textValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
CultureInfo.InvariantCulture, out double tmpDouble)) CultureInfo.InvariantCulture, out double tmpDouble))
result = tmpDouble; result = tmpDouble;
if (result == null) if (result == null)
{ {
if (double.TryParse(val, out tmpDouble)) // current language style (==GER, mit , statt .) if (double.TryParse(textValue, out tmpDouble)) // current language style (==GER, mit , statt .)
result = tmpDouble; result = tmpDouble;
} }
} }
if ((result == null) && (val != null))
{
double tmpDouble2 = val[1, 1];
result = tmpDouble2;
}
return result; return result;
} }
catch (Exception e) catch (Exception e)
@ -759,7 +786,6 @@ namespace ENI2.Excel
return null; return null;
} }
#endregion Dakosy-specific functions #endregion Dakosy-specific functions
} }
} }

View File

@ -1,12 +1,10 @@
using System; // Copyright (c) 2017- schick Informatik
// Description: Dumps Maersk data into a simple Excel file
//
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using ClosedXML.Excel;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;
using bsmd.database; using bsmd.database;
namespace ENI2.Excel namespace ENI2.Excel
@ -17,68 +15,58 @@ namespace ENI2.Excel
{ {
data.Sort(); data.Sort();
Application excelApp = new Application(); using (var workbook = new XLWorkbook())
excelApp.DisplayAlerts = false;
excelApp.Visible = false;
Workbook wb = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
Worksheet ws = wb.Worksheets[1];
// Überschriften erste Zeile
ws.Cells[1, 1] = "ETA";
ws.Cells[1, 2] = "ETD";
ws.Cells[1, 3] = "Rotation name";
ws.Cells[1, 4] = "Vessel code";
ws.Cells[1, 5] = "Vessel name";
ws.Cells[1, 6] = "IMO";
ws.Cells[1, 7] = "Arr voy";
ws.Cells[1, 8] = "Dep voy";
ws.Cells[1, 9] = "Terminal name";
ws.Cells[1, 10] = "Operator code";
ws.Cells[1, 11] = "Pro arr";
ws.Cells[1, 12] = "Pro dep";
ws.Cells[1, 13] = "ID";
ws.Cells[1, 14] = "Remark";
for (int i = 0; i < data.Count; i++)
{ {
MaerskData md = data[i]; var worksheet = workbook.Worksheets.Add("Sheet1");
ws.Cells[i + 2, 1].NumberFormat = "TT/hh:mm"; // Headers in first row
ws.Cells[i + 2, 1] = md.ColA; worksheet.Cell(1, 1).Value = "ETA";
ws.Cells[i + 2, 2].NumberFormat = "TT/hh:mm"; worksheet.Cell(1, 2).Value = "ETD";
ws.Cells[i + 2, 2] = md.ColB; worksheet.Cell(1, 3).Value = "Rotation name";
ws.Cells[i + 2, 3] = md.ColC; worksheet.Cell(1, 4).Value = "Vessel code";
ws.Cells[i + 2, 4] = md.ColD; worksheet.Cell(1, 5).Value = "Vessel name";
ws.Cells[i + 2, 5] = md.ColE; worksheet.Cell(1, 6).Value = "IMO";
ws.Cells[i + 2, 6] = md.ColF; worksheet.Cell(1, 7).Value = "Arr voy";
ws.Cells[i + 2, 7] = md.ColG; worksheet.Cell(1, 8).Value = "Dep voy";
ws.Cells[i + 2, 8] = md.ColH; worksheet.Cell(1, 9).Value = "Terminal name";
ws.Cells[i + 2, 9] = md.ColI; worksheet.Cell(1, 10).Value = "Operator code";
ws.Cells[i + 2, 10] = md.ColJ; worksheet.Cell(1, 11).Value = "Pro arr";
ws.Cells[i + 2, 11] = md.ColK; worksheet.Cell(1, 12).Value = "Pro dep";
ws.Cells[i + 2, 12] = md.ColL; worksheet.Cell(1, 13).Value = "ID";
ws.Cells[i + 2, 13] = md.ColM ; worksheet.Cell(1, 14).Value = "Remark";
ws.Cells[i + 2, 14] = md.Remark;
if((md.MessageCore != null) && (md.MessageCore.Cancelled ?? false)) for (int i = 0; i < data.Count; i++)
{ {
ws.Rows[i + 2].Font.Strikethrough = true; MaerskData md = data[i];
int row = i + 2; // Data starts from row 2
worksheet.Cell(row, 1).Value = md.ColA;
worksheet.Cell(row, 1).Style.NumberFormat.Format = "dd/hh:mm";
worksheet.Cell(row, 2).Value = md.ColB;
worksheet.Cell(row, 2).Style.NumberFormat.Format = "dd/hh:mm";
worksheet.Cell(row, 3).Value = md.ColC;
worksheet.Cell(row, 4).Value = md.ColD;
worksheet.Cell(row, 5).Value = md.ColE;
worksheet.Cell(row, 6).Value = md.ColF;
worksheet.Cell(row, 7).Value = md.ColG;
worksheet.Cell(row, 8).Value = md.ColH;
worksheet.Cell(row, 9).Value = md.ColI;
worksheet.Cell(row, 10).Value = md.ColJ;
worksheet.Cell(row, 11).Value = md.ColK;
worksheet.Cell(row, 12).Value = md.ColL;
worksheet.Cell(row, 13).Value = md.ColM;
worksheet.Cell(row, 14).Value = md.Remark;
if ((md.MessageCore != null) && (md.MessageCore.Cancelled ?? false))
{
worksheet.Row(row).Style.Font.Strikethrough = true;
}
} }
workbook.SaveAs(filename);
} }
wb.SaveAs(filename, XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
wb.Saved = true;
wb.Close(0);
Marshal.ReleaseComObject(ws);
Marshal.ReleaseComObject(wb);
excelApp.Quit();
Marshal.ReleaseComObject(excelApp);
} }
} }
} }

View File

@ -1,8 +1,8 @@
// Copyright (c) 2017- schick Informatik // Copyright (c) 2017- schick Informatik
// Description: // Description: Writing excel files
// //
using Microsoft.Office.Interop.Excel; using ClosedXML.Excel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
@ -26,10 +26,9 @@ namespace ENI2.Excel
if (isRefSheet) filename = @"Excel\Reference_Sheet_DE.xlsx"; if (isRefSheet) filename = @"Excel\Reference_Sheet_DE.xlsx";
string refFilePath = System.IO.Path.Combine(Environment.CurrentDirectory, filename); string refFilePath = System.IO.Path.Combine(Environment.CurrentDirectory, filename);
this._workBook = _excelWorkbooks.Open(refFilePath, 0, true, 5, "", "", false, XlPlatform.xlWindows, "", false, false, 0, false, false, false); this._workBook = new XLWorkbook(refFilePath);
this.InitNameFields(); this.InitNameFields();
} }
#endregion #endregion
@ -44,7 +43,7 @@ namespace ENI2.Excel
{ {
try try
{ {
switch(message.MessageNotificationClass) switch (message.MessageNotificationClass)
{ {
case Message.NotificationClass.AGNT: case Message.NotificationClass.AGNT:
if (message.Elements[0] is AGNT agnt) this.WriteMessage(agnt); if (message.Elements[0] is AGNT agnt) this.WriteMessage(agnt);
@ -84,10 +83,10 @@ namespace ENI2.Excel
break; break;
case Message.NotificationClass.HAZA: case Message.NotificationClass.HAZA:
this.WriteHAZ(message, true); this.WriteHAZ(message, true);
break; break;
case Message.NotificationClass.HAZD: case Message.NotificationClass.HAZD:
this.WriteHAZ(message, false); this.WriteHAZ(message, false);
break; break;
case Message.NotificationClass.INFO: case Message.NotificationClass.INFO:
if (message.Elements[0] is INFO info) if (message.Elements[0] is INFO info)
{ {
@ -192,11 +191,6 @@ namespace ENI2.Excel
} }
public void WriteMaerskList(List<MaerskData> maerskList)
{
}
#endregion #endregion
#region private excel field writing #region private excel field writing
@ -242,7 +236,7 @@ namespace ENI2.Excel
else if (property.PropertyType == typeof(Boolean?)) else if (property.PropertyType == typeof(Boolean?))
{ {
object boolVal = property.GetValue(dbEntity); object boolVal = property.GetValue(dbEntity);
if(boolVal != null) if (boolVal != null)
success = this.WriteBoolean(lookupNameAttribute.LookupName, boolVal); success = this.WriteBoolean(lookupNameAttribute.LookupName, boolVal);
} }
else else
@ -374,6 +368,9 @@ namespace ENI2.Excel
#endregion #endregion
// [Rest of the methods remain exactly the same as they only call the base class methods]
// I'll include a few key ones to show the pattern, but the rest are identical...
#region CREW #region CREW
private void WriteCREW(Message crewMessage, bool isArrival, bool isRefSheet) private void WriteCREW(Message crewMessage, bool isArrival, bool isRefSheet)
@ -385,7 +382,7 @@ namespace ENI2.Excel
WriteBoolean(string.Format("CREW{0}.NotificationPAX", isArrival ? "" : "D"), ((CREW)crewMessage.Elements[0]).NotificationPAX); WriteBoolean(string.Format("CREW{0}.NotificationPAX", isArrival ? "" : "D"), ((CREW)crewMessage.Elements[0]).NotificationPAX);
} }
for(int i = 0; i<Math.Min(crewMessage.NumberOfExcelRows, crewMessage.Elements.Count); i++) for (int i = 0; i < Math.Min(crewMessage.NumberOfExcelRows, crewMessage.Elements.Count); i++)
{ {
string crewLastName = string.Format("CREW{1}.CrewMemberLastName_{0}", i + 1, isArrival ? "" : "D"); string crewLastName = string.Format("CREW{1}.CrewMemberLastName_{0}", i + 1, isArrival ? "" : "D");
string crewFirstName = string.Format("CREW{1}.CrewMemberFirstName_{0}", i + 1, isArrival ? "" : "D"); string crewFirstName = string.Format("CREW{1}.CrewMemberFirstName_{0}", i + 1, isArrival ? "" : "D");
@ -413,7 +410,7 @@ namespace ENI2.Excel
WriteText(crewNationality, crew.CrewMemberNationality); WriteText(crewNationality, crew.CrewMemberNationality);
WriteText(crewDuty, crew.CrewMemberDuty); WriteText(crewDuty, crew.CrewMemberDuty);
WriteText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth); WriteText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth);
if(crew.CrewMemberDateOfBirth.HasValue) if (crew.CrewMemberDateOfBirth.HasValue)
WriteDate(crewDateOfBirth, crew.CrewMemberDateOfBirth.Value); WriteDate(crewDateOfBirth, crew.CrewMemberDateOfBirth.Value);
WriteText(crewIdentDocType, crew.CrewMemberIdentityDocumentTypeDisplay); WriteText(crewIdentDocType, crew.CrewMemberIdentityDocumentTypeDisplay);
WriteText(crewIdentDocId, crew.CrewMemberIdentityDocumentId); WriteText(crewIdentDocId, crew.CrewMemberIdentityDocumentId);
@ -424,16 +421,16 @@ namespace ENI2.Excel
} }
else else
{ {
if(!crew.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty() && !crew.CrewMemberIdentityDocumentIssuingState.Equals("XX")) if (!crew.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty() && !crew.CrewMemberIdentityDocumentIssuingState.Equals("XX"))
WriteText(crewIssuingState, crew.CrewMemberIdentityDocumentIssuingState); WriteText(crewIssuingState, crew.CrewMemberIdentityDocumentIssuingState);
} }
if(isRefSheet) if (isRefSheet)
{ {
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate); WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
} }
else else
{ {
if(crew.CrewMemberIdentityDocumentExpiryDate != new DateTime(2100, 12, 31)) if (crew.CrewMemberIdentityDocumentExpiryDate != new DateTime(2100, 12, 31))
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate); WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
} }
@ -1066,7 +1063,7 @@ namespace ENI2.Excel
string tLen = string.Format("TOWD.TowageOnDepartureLengthOverall_MTR_{0}", i + 1); string tLen = string.Format("TOWD.TowageOnDepartureLengthOverall_MTR_{0}", i + 1);
string tBeam = string.Format("TOWD.TowageOnDepartureBeam_MTR_{0}", i + 1); string tBeam = string.Format("TOWD.TowageOnDepartureBeam_MTR_{0}", i + 1);
string tOp = string.Format("TOWD.TowageOnDepartureOperatorCompanyName_{0}", i + 1); string tOp = string.Format("TOWD.TowageOnDepartureOperatorCompanyName_{0}", i + 1);
string tPoc = string.Format("TOWD.TowageOnDeparturePurposeOfCall_{0}", i + 1); // string tPoc = string.Format("TOWD.TowageOnDeparturePurposeOfCall_{0}", i + 1);
TOWD towd = towdMessage.Elements[i] as TOWD; TOWD towd = towdMessage.Elements[i] as TOWD;
@ -1276,7 +1273,7 @@ namespace ENI2.Excel
private void WriteGenderCode(string label, byte? gender) private void WriteGenderCode(string label, byte? gender)
{ {
if(gender.HasValue) if (gender.HasValue)
{ {
if (gender == 0) WriteText(label, "not known"); if (gender == 0) WriteText(label, "not known");
if (gender == 1) WriteText(label, "m"); if (gender == 1) WriteText(label, "m");
@ -1303,15 +1300,24 @@ namespace ENI2.Excel
private bool WriteBoolean(string lookupName, object v) private bool WriteBoolean(string lookupName, object v)
{ {
bool result = _nameDict.ContainsKey(lookupName); bool result = _nameDict.ContainsKey(lookupName);
bool? b = (bool?) v; bool? b = (bool?)v;
try try
{ {
if (result && b.HasValue) if (result && b.HasValue)
{ {
_nameDict[lookupName].RefersToRange.Value = b.Value ? "Y" : "N"; var definedName = _nameDict[lookupName];
var range = definedName.Ranges.FirstOrDefault();
if (range != null)
{
var cell = range.FirstCell();
if (cell != null)
{
cell.Value = b.Value ? "Y" : "N";
}
}
} }
} }
catch(Exception) catch (Exception)
{ {
System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName)); System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName));
} }
@ -1326,10 +1332,19 @@ namespace ENI2.Excel
{ {
if (result) if (result)
{ {
_nameDict[lookupName].RefersToRange.Value = v; var definedName = _nameDict[lookupName];
var range = definedName.Ranges.FirstOrDefault();
if (range != null)
{
var cell = range.FirstCell();
if (cell != null)
{
cell.Value = ClosedXML.Excel.XLCellValue.FromObject(v);
}
}
} }
} }
catch(Exception) catch (Exception)
{ {
System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName)); System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName));
} }
@ -1343,7 +1358,16 @@ namespace ENI2.Excel
if (result) if (result)
{ {
_nameDict[lookupName].RefersToRange.Value = v; var definedName = _nameDict[lookupName];
var range = definedName.Ranges.FirstOrDefault();
if (range != null)
{
var cell = range.FirstCell();
if (cell != null)
{
cell.Value = ClosedXML.Excel.XLCellValue.FromObject(v);
}
}
} }
return result; return result;
@ -1355,11 +1379,19 @@ namespace ENI2.Excel
if (result) if (result)
{ {
if(v != null) if (v != null)
{ {
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate(); var definedName = _nameDict[lookupName];
var range = definedName.Ranges.FirstOrDefault();
if (range != null)
{
var cell = range.FirstCell();
if (cell != null)
{
cell.Value = ClosedXML.Excel.XLCellValue.FromObject(((DateTime)v).ToLocalTime());
}
}
} }
} }
return result; return result;
@ -1373,9 +1405,17 @@ namespace ENI2.Excel
{ {
if (v != null) if (v != null)
{ {
_nameDict[lookupName].RefersToRange.Value = ((DateTime)v).ToLocalTime().ToShortTimeString(); var definedName = _nameDict[lookupName];
var range = definedName.Ranges.FirstOrDefault();
if (range != null)
{
var cell = range.FirstCell();
if (cell != null)
{
cell.Value = ((DateTime)v).ToLocalTime().ToString("HH:mm");
}
}
} }
} }
return result; return result;

View File

@ -12,7 +12,7 @@ namespace ENI2.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -117,7 +117,7 @@ namespace ENI2.LockingServiceReference {
return this.CORRUPTFilesField; return this.CORRUPTFilesField;
} }
set { set {
if ((ReferenceEquals(this.CORRUPTFilesField, value) != true)) { if ((object.ReferenceEquals(this.CORRUPTFilesField, value) != true)) {
this.CORRUPTFilesField = value; this.CORRUPTFilesField = value;
this.RaisePropertyChanged("CORRUPTFiles"); this.RaisePropertyChanged("CORRUPTFiles");
} }
@ -143,7 +143,7 @@ namespace ENI2.LockingServiceReference {
return this.IMPFilesField; return this.IMPFilesField;
} }
set { set {
if ((ReferenceEquals(this.IMPFilesField, value) != true)) { if ((object.ReferenceEquals(this.IMPFilesField, value) != true)) {
this.IMPFilesField = value; this.IMPFilesField = value;
this.RaisePropertyChanged("IMPFiles"); this.RaisePropertyChanged("IMPFiles");
} }
@ -156,7 +156,7 @@ namespace ENI2.LockingServiceReference {
return this.READYFilesField; return this.READYFilesField;
} }
set { set {
if ((ReferenceEquals(this.READYFilesField, value) != true)) { if ((object.ReferenceEquals(this.READYFilesField, value) != true)) {
this.READYFilesField = value; this.READYFilesField = value;
this.RaisePropertyChanged("READYFiles"); this.RaisePropertyChanged("READYFiles");
} }

View File

@ -2,25 +2,24 @@
<packages> <packages>
<package id="ClosedXML" version="0.105.0" targetFramework="net48" /> <package id="ClosedXML" version="0.105.0" targetFramework="net48" />
<package id="ClosedXML.Parser" version="2.0.0" targetFramework="net48" /> <package id="ClosedXML.Parser" version="2.0.0" targetFramework="net48" />
<package id="DocumentFormat.OpenXml" version="3.1.1" targetFramework="net48" /> <package id="DocumentFormat.OpenXml" version="3.3.0" targetFramework="net481" />
<package id="DocumentFormat.OpenXml.Framework" version="3.1.1" targetFramework="net48" /> <package id="DocumentFormat.OpenXml.Framework" version="3.3.0" targetFramework="net481" />
<package id="ExcelNumberFormat" version="1.1.0" targetFramework="net48" /> <package id="ExcelNumberFormat" version="1.1.0" targetFramework="net48" />
<package id="Extended.Wpf.Toolkit" version="5.0.0" targetFramework="net48" /> <package id="Extended.Wpf.Toolkit" version="5.0.0" targetFramework="net48" />
<package id="log4net" version="3.2.0" targetFramework="net48" /> <package id="log4net" version="3.2.0" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Bcl.Cryptography" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Bcl.Cryptography" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net48" /> <package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net481" />
<package id="Microsoft.Extensions.DependencyInjection" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Extensions.DependencyInjection" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Extensions.Logging" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Extensions.Logging" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Extensions.Logging.Abstractions" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Extensions.Options" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Extensions.Options" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Extensions.Primitives" version="9.0.9" targetFramework="net48" /> <package id="Microsoft.Extensions.Primitives" version="9.0.9" targetFramework="net48" />
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net48" />
<package id="PDFsharp" version="6.2.2" targetFramework="net48" /> <package id="PDFsharp" version="6.2.2" targetFramework="net48" />
<package id="PDFsharp-MigraDoc" version="6.2.2" targetFramework="net48" /> <package id="PDFsharp-MigraDoc" version="6.2.2" targetFramework="net48" />
<package id="RBush.Signed" version="4.0.0" targetFramework="net48" /> <package id="RBush.Signed" version="4.0.0" targetFramework="net48" />
<package id="SixLabors.Fonts" version="1.0.0" targetFramework="net48" /> <package id="SixLabors.Fonts" version="1.0.0" targetFramework="net481" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" /> <package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" />
<package id="System.Buffers" version="4.6.1" targetFramework="net48" /> <package id="System.Buffers" version="4.6.1" targetFramework="net48" />
<package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" /> <package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" />