Search code examples
c#excelpdfreflectionspire

Convert Excel file to PDF throws a Reflection Exception instantiating workbook Spire.Xls workbook


I just want to use Spire to get an Excel file and save as PDF:

Workbook workbook = new Workbook();
workbook.LoadFromFile(@"D:\excels\Report.xlsx", ExcelVersion.Version2016);
workbook.SaveToFile(@"D:\excels\" + name + ".pdf", Spire.Xls.FileFormat.PDF);

but it throws the following exception at the first line:

enter image description here

Is a ReflectionTypeLoadException when trying to load a workbook using Spire.XLS library

I have reinstalled library , set copy to local to true in all references but still throws the exception.

Any ideas?

Thanks


Solution

  • well, after performing a deep cleanup of dependencies , packages ..then uninstalling libraries and installing Spire.XLS only (the one I need) again...it worked!