Position of drawn line is not correct in image


I use this code to create an image out of this file Files.zip (328.0 KB)

Workbook w3 = new Workbook(“Excel file with Images_V1.xlsx”);
Worksheet excelWorksheet = w3.Worksheets[“Interest ratio”];
Aspose.Cells.Range range = excelWorksheet.Workbook.Worksheets.GetRangeByName(“BIPLI_KURTIS2”);
string startCell = CellsHelper.CellIndexToName(range.FirstRow, range.FirstColumn);
string endCell = CellsHelper.CellIndexToName(range.FirstRow + range.RowCount - 1, range.FirstColumn + range.ColumnCount - 1);
string rangeAddress = string.Format("{0}:{1}", startCell, endCell);

        ImageOrPrintOptions options = new ImageOrPrintOptions();
        options.AllColumnsInOnePagePerSheet = true;
        options.ImageType = Aspose.Cells.Drawing.ImageType.Emf;
        //options.ImageFormat = ImageFormat.Emf;
        options.OnePagePerSheet = true;
        options.HorizontalResolution = 600;
        options.VerticalResolution = 600;
        options.OnlyArea = true;

        Aspose.Cells.PageSetup pageSetup = excelWorksheet.PageSetup;

        pageSetup.PrintArea = rangeAddress;
        using (MemoryStream imageStream = new MemoryStream())
            SheetRender sr = new SheetRender(excelWorksheet, options);
            sr.ToImage(0, imageStream);
            Image.FromStream(imageStream).Save("KURTIS2.png", ImageFormat.Emf);
            //imagePartsList.Add(rangeName, );

If you compare the red dotted line with the image, the position is not correct

Kind regards,

We have logged the issue as “CELLSNET-49043” in our database for investigations. Once we will have some news for you, we will update you in this topic.

Hi @Nachti
We did further investigation, one of the issue’s reasons is the margins of charts, which don’t have a fixed standard.
Please use Aspose.Cells 21.9.3, we optimized the margins of the chart to be better and to accommodate more situations.

Aspose.Cells21.9.3 For .Net2_AuthenticodeSigned.Zip (5.6 MB)
Aspose.Cells21.9.3 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.9.3 For .NetStandard20.Zip (5.6 MB)

The issues you have found earlier (filed as CELLSNET-49043) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao