Get Picture from Excel:Size and position change of callout boxes

Hi,

I use following code to create an image from an Excel Range:
this is the file BIPLI callouts format.zip (29.1 KB)

xlsLic.SetLicense(“Aspose.Total.lic”);
Workbook w2 = new Workbook(“BIPLI callouts format.xlsx”);
Worksheet excelWorksheet = w2.Worksheets[“y-to-y”];
Aspose.Cells.Range range = excelWorksheet.Workbook.Worksheets.GetRangeByName(“BIPLI_EN_YtY”);
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.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("pic.png", ImageFormat.Emf);
           
        };

@Nachti,
Thank you for your query. I have tried this sample code with the template file using latest version Aspose.Cells for .NET 19.10 but could not observe any issue. Could you please share which version of Aspose.Cells is used for testing at your end? You may please give a try using latest version and share the feedback. If still issue is there, share the issue details along with the images for our analysis. The program output file is attached here for your reference.
pic.png (326.1 KB)

Hi ahsaniq,

I tried it with 19.10 with the same result:
the callout box moves together with the linking line.

diff.JPG (106.0 KB)

Check the image. you can see that in Excel the call out box line hits the row line but not in the picture.

Kind regards,
Guido

@Nachti,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46988 – Callout line does render exactly in the image when converted from Excel

@Nachti,

For your problem, we think lines are drawn in the right place, but the position of the axis is not correct. We are trying to fix it now.

Once we figure it out, we will let you know and share the Download link to the fix.

@Nachti,
We have made a detailed check on this problem and traced it to Chart.xml of XLSX file. It is found that Chart has an offset of Y coordinate, and we have processed it accordingly before. However, Excel is suspected to have some logic of its own, which ignores this offset in some special cases. As a result, the chart we draw is different from Excel.

Since this y offset cannot be simply and rudely ignored, it can be a big problem. So at present, this question also needs to be studied, in what special circumstances to ignore it. We will further update you soon.