Have this code to convert XLS to Image and it throws an error:
"parameter is not valid" exception.
.xlsx files work without issues but when I try with .xls file I get the"parameter is not valid" exception.
Really need this to work ASAP. Please share how to fix.
for (i = 0; i < workbook.Worksheets.Count; i++)
{
IWorksheet sheet = workbook.Worksheets[i];
sheet.UsedRangeIncludesFormatting = false;
int lastRow = sheet.UsedRange.LastRow + 1;
int lastColumn = sheet.UsedRange.LastColumn + 1;
try
{
//This code line creates an issue only for .xls file.
Image image = sheet.ConvertToImage(1, 1, lastRow, lastColumn, Syncfusion.XlsIO.ImageType.Bitmap, null);
image.Save(outputPath + "_" + i + ".jpeg", ImageFormat.Jpeg);
}
catch (Exception ex)
{
throw ex;
}
}