Wrong border lines appears in the rendered image

Hi,

When converting a worksheet to an image, I noticed there’s strange white border lines in the image.
Code:
var workbook = new Workbook(@“test.xlsx”);
var options = new ImageOrPrintOptions
{
ImageFormat = ImageFormat.Emf,
OnlyArea = false,
TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
OnePagePerSheet = true
};
var sheet = workbook.Worksheets[0];
sheet.PageSetup.PrintArea = “B4:C7”;
sheet.PageSetup.LeftMargin =
sheet.PageSetup.RightMargin = sheet.PageSetup.TopMargin = sheet.PageSetup.BottomMargin = sheet.PageSetup.HeaderMargin = sheet.PageSetup.FooterMargin = 0;
SheetRender render = new SheetRender(sheet, options);
render.ToImage(0, @“out.emf”);

I’ve attached the test files. After the output emf file is produced, paste it into the table in the Word document, zoom in around 100%-150%, and the white lines appears. (I’ve attached a screenshot for your reference)
image.png
The white lines are not visible when I copy/paste the worksheet manually using Ms Office. Could you please take a look and let me know how to avoid this issue?
test.zip (20.0 KB)
screenshot.zip (37.6 KB)

Thanks,

@ServerSide527

Please upload the attachments again as we are unable to download your attachments. Thanks for your cooperation in this regard.

test.zip (20.0 KB)
screenshot.zip (37.6 KB)
Edit : Looks like I was unable to update attachment (the link is invalid) at the moment, could you please let me know how to upload the attachment?

sample.zip (5.7 KB)

Your attachment is not accessible either (Oops! That page doesn’t exist or is private.), are there any website issues going on?

@ServerSide527

We have reported this issue to our Web Team and it will be fixed as soon as possible. Meanwhile, could you upload your attachments on Dropbox or Google Drive etc. and share the link here.

Please find the test files here:

@ServerSide527,

Thanks for providing us template file, output image and screenshot, etc.

After an initial test, I am able to observe the issue as you mentioned by using your sample code with your template file. I found wrong border line (white) appears in the rendered image in Sheet to image conversion. I have to paste the output EMF into MS Word table to spot the line.

I have logged a ticket with an id “CELLSNET-45789” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@ServerSide527,

We did evaluate your issue further. The actual output area is 189.2 X 73.1 pixels, we apply Math.Ceiling to width and height, so the output image is 190 X 74 pixels, this is the root cause of the white line issue. A workaround is to add a thick border with same color as background to the output area.(see the attachment “test_border.xlsx”) in the zipped archive.
test_border.zip (8.2 KB)

Hi,

Thanks for explaining the issue and the workaround provided.

I feel like a 1px border cannot round the 189.2 * 73.1 area up to exactly 190 * 74, so there should still be empty border in the output image even if it might not be that obvious.

So I tested using your sample test_border.xlsx, I found the border indeed disappear at 150% but when zooming out to 50% the border appears again and it looked even worse at the top:
image.png (5.5 KB)

Could you please help me look into this?

Thanks

@ServerSide527,

Thanks for the screenshot and details.

You are right as I tested. I found when the output EMF file is inserted into your document table and set the zoom level to 50%, the white line still shows. I have logged your findings and concerns against your issue “CELLSNET-45789” into our database. Our concerned developer from product team will evaluate it further.

Once we have any new information, we will share it with you.

@ServerSide527,

Well, In case there are borders on the print area, we need more place to draw borders, so we apply ceiling to the width and height of actual output area. e.g. 189.2 X 73.1 pixels to 190 X 74 pixels.

Thanks for the explanation. As the workaround was not working as we tested, I will be waiting for the fix on this.

@ServerSide527,

Yes, sure, the issue is open and our concerned developer from product team is working over it and will try to figure it out (if possible).