Range of cells to image issue

Hi.
When I saved a range of cells as image, I lost right and bottom cell boundaries (on the edge of the image), please see attached file.

Here is code:
Worksheet ws = new Workbook(fWbName).Worksheets[sheetIdx];
ImageOrPrintOptions imgOpt = new ImageOrPrintOptions();
imgOpt.IsCellAutoFit = true;
imgOpt.OnePagePerSheet = true;
imgOpt.PrintingPage = PrintingPageType.IgnoreBlank;

ws.PageSetup.PrintArea = range;
ws.PageSetup.LeftMargin = 0;
ws.PageSetup.RightMargin = 0;
ws.PageSetup.BottomMargin = 0;
ws.PageSetup.TopMargin = 0;

SheetRender sr = new SheetRender(ws, imgOpt);
sr.ToImage(0, fImgName);

Thanks,
Alex Shloma

Hi,

Actually, part of border lies in other row or column.

Suppose your right border ends in column F, then you should include column G also in your print area.

Then, you should set the width of column G to minimum.

Similarly, if your bottom border ends at row 20, then you should include row 21 also in your print area.

Then, you should set the height of the row 21 to minimum.

This thread deals with the same issue. Please see if it is helpful for you.

Cell borders missing when using PrintArea and OnePagePerSheet = true

Thanks for help. I appreciate your quick answer.

Regards,
Alex Shloma