Cannot add password to excel file using groupdocs.merger

HI
I am using Groupdocs merger to add the password to files.
But for excel files it throws this error. But other file types it works fine.
Here with I have attached the sample project for your referance.

Thanks
TilankaConsoleApp1.zip (6.3 KB)

GroupDocs.Merger.Exceptions.GroupDocsMergerException
HResult=0x80131500
Message=The type initializer for ‘’ threw an exception.
Source=GroupDocs.Merger
StackTrace:
at GroupDocs.Merger.Merger.AddPassword(IAddPasswordOptions addPasswordOptions)
at ConsoleApp1.Program.AddPWD() in C:\Users\Tilanka\Documents\Example\GroupDocs\ConsoleApp1\ConsoleApp1\Program.cs:line 38
at ConsoleApp1.Program.Main(String[] args) in C:\Users\Tilanka\Documents\Example\GroupDocs\ConsoleApp1\ConsoleApp1\Program.cs:line 17

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
TypeInitializationException: The type initializer for ‘’ threw an exception.

Inner Exception 2:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 3:
InvalidOperationException: Operation is not valid due to the current state of the object.

1 Like

@tilankak

It’s been observed that when we add Aspose.Cells reference in the project, we get these exceptions. Otherwise, we can successfully protect the Spreadsheet.
However, to address this issue, we have logged a ticket in our internal issue tracking system. Your investigation ticket ID is MERGERNET-1401. You’ll be notified in case of any update.

Our project need to use Aspose.cells. we cannot remove it

@tilankak

We are already investigating this issue.

also when I removed the aspose.cells reference it throws error.ConsoleApp2.zip (3.2 KB)

GroupDocs.Merger.Exceptions.GroupDocsMergerException: ‘Could not load file or assembly ‘Aspose.Cells, Version=23.4.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.’

1 Like

@tilankak

Thanks for the sample application. We’ll continue our investigation. You’ll be notified in case of any update.

what is the situation of this ticket. we are struck on this.

Thaks

@tilankacft

Apologies for any inconvenience caused. We are still investigating your ticket, and we will promptly notify you of any updates as soon as they become available.

@tilankacft

After investigating your application, we have found that removing the App.config file will resolve the issue and the project will function correctly.
Additionally, we would like to address the compatibility concern. It appears that you are attempting to use Aspose.Cells version 23.4 with GroupDocs.Merger version 23.3.1, which is not the recommended configuration. Please ensure that the version of Aspose.Cells is equal to or smaller than the version of GroupDocs.Merger for proper compatibility.
Thank you for your understanding.