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 ?
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(); }
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
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/