Some issue while getting image from range


I face some issues when using code below using Aspose.Cells

here the attachments: (359.3 KB)

Here are the issues (check the attached images)

  1. The lines are much thicker in Word than Excel (not so much with version Aspose but still thicker)

  2. The lines don’t seem to meet in the exact middle of the chart like they do in Excel and shows a star in the middle

  3. The text spacing between letters is different

  4. The text positioning differs

  5. A red line that we had inserted in Excel did not keep its same position after it had been inserted into Word. It moved slightly to the left

  6. Text that we had inserted (“Refer to footnote 2”) moved slightly to the left as well

Used code:

Workbook w2 = new Workbook(“Excel file with Images_V1.xlsx”);
Worksheet excelWorksheet = w2.Worksheets[“Composition of revenues”];
Aspose.Cells.Range range = excelWorksheet.Workbook.Worksheets.GetRangeByName(“BIPLI_KURTIS1”); 'BIPLI_KURTIS2 for issues 5 and 6
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("", ImageFormat.Emf);
            //imagePartsList.Add(rangeName, );

We are analysing this issue and will share our feedback soon.

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-47067 – Excel to Image: Issues while getting image from range