after change options.ImageType = ImageType.Jpeg; the code and output image is OK
but if you apply data filter on the sheet[hide some rows] , you will get a worng row Height in output image
Thanks for the sample code, sample video and template file.
Please update your code as following, it will work fine as I tested:
e.g Sample code:
var workbook = new Workbook(“fail_detail_statistics___sms__2018-07-11_.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];
// Set the print area with your desired range
// Set all margins as 0
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
AutoFitterOptions autofitterOptions = new AutoFitterOptions(); autofitterOptions.IgnoreHidden = true; worksheet.AutoFitRows(autofitterOptions);
// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.OnePagePerSheet = true;
options.ImageType = ImageType.Jpeg;
options.HorizontalResolution = 100;
options.VerticalResolution = 100;
// Take the image of your worksheet
SheetRender sr = new SheetRender(worksheet, options);
sr.ToImage(0, "ww.jpg");
workbook.Save("123.xlsx");
Process.Start("ww.jpg");
Could you try my sample code and provide the output image file here, we will check it soon. Also, give us screenshot with details which wrong row height you are talking about?