Why can't I convert an Excel file to an image using Spire.Xls in Linux?

806 Views Asked by At

I converted A Excel file to A Image In C# but i found that the API i used is Only for windows btw i am using linux

using Spire.Xls;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System;

namespace Convert
{
    class MainC
    {
        public static void Main(string[] args)
        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("Test121.xlsx", ExcelVersion.Version2013);
            Worksheet worksheet = workbook.Worksheets[0];
            
            using (MemoryStream ms = new MemoryStream())
            {
                
                worksheet.ToEMFStream(ms, 1, 1, worksheet.LastRow, worksheet.LastColumn);
                Image image = Image.FromStream(ms);
                Bitmap images = ResetResolution(image as Metafile, 300);
                images.Save("Test121.jpg", ImageFormat.Jpeg);
            }
        }
    }
}
1

There are 1 best solutions below

1
Dheeraj Malik On BEST ANSWER

Spire.XLS can be used on Linux. You do not need to install the msi, just download the hotfix version which only contains DLLs: enter image description here

Then reference the DLLs under the netcoreappX.0 folder into your net core project. enter image description here