Good day!
I was having an issue about converting a worksheet. I have 3 worksheets, the first worksheet has a value but sheet 2 and sheet 3 has no value or no data entered.
I was about to save a worksheet to image file and throws a object reference error in c#. Upon investigating the issue I have found out that the code could not able to convert a worksheet that has no value. The question is how will I know if the worksheet has no value? this is to avoid converting the blank worksheets.
Here's the example code that I use to convert a Image. The code is working perfectly but I haven't find any code that can detect that the worksheet is empty or no value.
Example code:
foreach (Worksheet sheetss in workbook.Worksheets)
{
Worksheet sheet = workbook.Worksheets[iRow];
sheet.SaveToImage(downloadPath + "_" + replacedFilename + "_" + iRow + ".jpg");
iRow++;
}
Thank you!