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


#1

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);
           
        };

#2

@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)


#3

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


#4

@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