Table has a white border when converted to image through SheetRender.ToImage

Hi,

When converting a table to image using SheetRender.ToImage in the resulted image the table has white borders on left and bottom sides.
For reproducing the issue please use the attached file and the following code:

var excelDocument = new Workbook(“excel.xlsx”);

var worksheet = excelDocument.Worksheets[0];

var imageOptions = new ImageOrPrintOptions
{
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true,
OnlyArea = true
};

const int startRow = 18;
const int startColumn = 7; //h
const int endRow = 22;
const int endColumn = 8; //i

var startColumnAsLiteral = CellsHelper.ColumnIndexToName(startColumn);
var endColumnAsLiteral = CellsHelper.ColumnIndexToName(endColumn);
worksheet.PageSetup.PrintArea = string.Format("{0}{1}:{2}{3}", startColumnAsLiteral, startRow + 1, endColumnAsLiteral, endRow + 1);

worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.BottomMargin = 0;

var sheetRender = new SheetRender(worksheet, imageOptions);

Image image = sheetRender.ToImage(0);

image.Save(“testImage.png”, ImageFormat.Png);


Best regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi Aurelian,

Thanks for your posting and using Aspose.Cells.

Please download and try the latest version: Aspose.Cells for .NET 8.4.0 and see if it makes any difference and resolve your issue.

I have executed your code with the latest version and it generated the correct image which I have attached for your reference.

Hi Shakeel,

The issue is almost solved but there are still small white borders on the left and the lower edges of the image, could you please check this ? A better way to see them is to place the image on a dark background.

Thank you,
Aurelian Iordache
Software Developer
IBM Romania

Hi Aurelian,


Thank you for highlighting the problem.

We have evaluated the presented scenario while using the latest version of Aspose.Cells for .NET 8.5.0.1, and we are able to see the very thin white border on the right & bottom of the generated image. We have logged an enhancement under the ticket CELLSNET-43757 to review if we can further enhance the rendering engine to remove this border. Please allow us some time to analyze this case and get back to with updates in this regard.

Hi Aurelian,


This is to inform you that we have enhanced the worksheet rendering process to address the issue logged earlier as CELLSNET-43757. We will shortly provide the fix here with next maintenance release of Aspose.Cells for .NET API.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.5.0.2 and let us know your feedback.

Hi Shakeel,

I tested with v.8.5.0.2 and I confirm the remaining issue is solved.
I’m attaching the resulted image here for your reference.
So I assume the fix will be present in the next public release.
Thank you very much ! :slight_smile:

Best regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi Aurelian.


Thank you for the confirmation. Yes, these enhancements will be part of the next official release of Aspose.Cells for .NET 8.5.1.

Hi,

This issue was fixed 8.5.0.2 but reappeared in Aspose Cells 8.5.0. Please investigate. Thanks!

Hi,


Do you mean Aspose.Cells for .NET v8.5.1? I have tested your scenario/ case using our latest fix/version:Aspose.Cells for .NET v8.5.1.2, it works fine.

If you still find the issue, kindly provide the screen shot of the image to highlight the issue using your original file and sample code, we will check it soon.

Thank you.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan