We’ve consistently been having trouble with LibreOffice Calc when modifying a workbook which we use for onboarding clients. Our internal tool uses EPPlus to read the file and generate user profiles. If I open the file in LibreOffice, make a change, and save the file, our internal tool throws an exception (see below). MS Excel also complains about the file after saving from LibreOffice, but does at least open it.
Can anyone offer any advice, or if a modification needs to be made to LibreOffice? I am not able to attach files to this post because I don’t have enough points.
Please note that we do not use EPPlus for modifying the workbook – that is not the source of the error.
If no changes are made, EPPlus accepts the file just fine.
If changes are made with MS Excel, EPPlus accepts the file just fine.
I am using LibreOffice 5.2.2.2 (x64) on Windows 10 version 1607, build 14393.321, but we have seen it occur in multiple other versions of LibreOffice and Windows.
System.ArgumentException was unhandled
HResult=-2147024809
Message=An item with the same key has already been added.
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at OfficeOpenXml.ExcelNamedRangeCollection.AddName(String Name, ExcelNamedRange item)
at OfficeOpenXml.ExcelNamedRangeCollection.Add(String Name, ExcelRangeBase Range)
at OfficeOpenXml.ExcelWorkbook.GetDefinedNames()
at OfficeOpenXml.ExcelPackage.get_Workbook()
at WorkbookImporter.Program.Main(String[] args) in C:\git\MediView\Utilities\WorkbookImporter\Program.cs:line 51
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: