I’m trying to open and decrypt the attached XLS file with the following code:
public int Decrypt(string inputFile, string password, string outputFile, ref string errMsg)
{
LoadOptions options = new LoadOptions();
options.Password = password;
Workbook doc = new Workbook(inputFile, options);
for (int idx = 0; idx < doc.Worksheets.Count; idx++)
{
if (doc.Worksheets[idx].IsProtected)
doc.Worksheets[idx].Unprotect(password);
}
doc.Unprotect(password);
doc.Settings.Password = null;
doc.Save(outputFile, saveFormat);
return 0;
}
With Invariant Globalization mode disabled for the .Net project. The above code works normally without issue.
But when I try to enable Invariant Globalization, I received the following exception:
Culture is not supported. (Parameter ‘culture’)
1033 (0x0409) is an invalid culture identifier.
This is the stack trace when the issue happens:
at System.Globalization.CultureData.GetCultureData(Int32 culture, Boolean bUseUserOverride)
at System.Globalization.CultureInfo…ctor(Int32 culture, Boolean useUserOverride)
at .(Int16 )
at Aspose.Cells.CustomImplementationFactory.CreateCultureInfo(Int32 lcid)
at .(CountryCode )
at .(CountryCode )
at Aspose.Cells.WorkbookSettings.set_Region(CountryCode value)
at .( )
at .( )
at .(Stream )
at .( , Stream )
at .( , Stream )
at .( , String )
at .()
at .(String , Stream , LoadOptions )
at Aspose.Cells.Workbook.(String , LoadOptions )
at Aspose.Cells.Workbook…ctor(String file, LoadOptions loadOptions)
at ().Decrypt(String inputFile, String password, String outputFile, String& errMsg)
File sample: password.7z (3.7 MB) (Password to decrypt: password.xls
)
This issue only happens on Linux, not on Windows. I’m using Aspose Cells version 22.3.
I kinda understand the situation as my sample file contains non-english characters and the invariant globalization feature is enabled.
But I also have other Word and Powerpoints files that has non-english characters as well, but the issue did not happened. Only with Aspose Cells that I have the above exception.
I want to know whether this is the expected behavior and is there any solution to resolve this problem.
Any help regarding this would be really appriciated. Thanks!