I am using Aspose.Cells to take snapshot of a range, when I get the image it has gridlines which are thicker and of a different color than in the excel sheet. I took one image using Range.getImage() of excel javascript API and I want my aspose image to look as close to that as possible. Also, I would rather not use borders because they overwrite any borders that are manually set on a range or table in excel(look at range called table).
Excel Js API Image -
image.png (9.6 KB)
(Don’t mind the blue background outside the range, not part of the image)
Aspose Image -
image.png (4.1 KB)
Source file-
sourceFile.zip (25.7 KB)
Here is my code -
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[namedRange.SheetIndex - 1];
Aspose.Cells.Range range = namedRange.GetRange();
worksheet.AutoFitRows();
worksheet.PageSetup.PrintArea = namedRange.RefersTo;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
worksheet.PageSetup.PrintGridlines = true;
worksheet.IsGridlinesVisible = true;
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions
{
OnePagePerSheet = true,
ImageType = ImageType.Jpeg,
HorizontalResolution = 400,
VerticalResolution = 400,
PrintingPage = PrintingPageType.IgnoreBlank,
GridlineType = GridlineType.Hair
};
SheetRender sr = new SheetRender(worksheet, imgOptions);