Trying to load a xlsm file in the workbook using -->
Workbook.Load(fileStream);
Getting an exception - Invalid or unrecognized file format. (Parameter 'stream')
This is a dot net standard 2.0 project. The same line of code works fine in a .net framework 4.6 project.
Any ideas on what can be the issue ?
Coolants are also significant in helping maintain optimal performance of machines, which can help businesses increase their productivity. Furthermore, coolants are used to keep a variety of items such as food and beverages at the correct temperature, ensuring that they remain safe and healthy. https://mycarcoolant.com/best-coolant-for-high-performance-cars/
First things first, how do we create a Xamarin Forms app with a .Net Standard 2.0 lib instead of a PCL.To accomplish this now ( without any new Visual Studio templates ), just create a new blank PCL Xamarin Forms app.When this is done, add an extra project but this time select a .Net Standard Library. You’ll get a popup window for selecting which version of .Net Standard you want to target, select Version 2.0!If you don’t see version 2.0 yet, that means that you still need to install the new .Net Core 2.0 SDK.
I hope this helps!
Ben Martin
Hello,
After further investigation, assuming the SSH.NET third-party library is used, the issue is in the OpenRead method. The workaround is to use a temporary file and the DownloadFile method of the library:
using (var client = new SftpClient(con)) { client.Connect(); using (FileStream fileStream = System.IO.File.Create(tempFilePath)) { client.DownloadFile(remoteDirectory, fileStream); workbook = Workbook.Load(fileStream); } System.IO.File.Delete(tempFilePath); client.Disconnect(); }
The only difference that I have in my use case is that my stream is not created using a local file in my code repo rather its fetched from a sftp server. If you can set that up locally, you will be able to reproduce my error.
Thank you for the provided information.
I have created and attached a sample trying to reproduce your issue. The excel file is loaded correctly as a file stream. Please test it on your side and let me know how it behaves.
If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce.
0676.Sample.zip