Hi,
it seems that scaling and layout has an impact on rendering the image:
see my code below:
Workbook w2 = new Workbook(“XL_V6.xlsx”);
Worksheet excelWorksheet = w2.Worksheets[“Sheet1”];
Aspose.Cells.Range range = excelWorksheet.Workbook.Worksheets.GetRangeByName(“BIPLI_PARTECIPOGRAMMA”);
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("pic.png", ImageFormat.Emf);
//imagePartsList.Add(rangeName, );
};
have a look at the result here result.zip (147.9 KB). Check the display settings. If I set it 125%, the image get shifted.
If I set it to 100%, it is ok. Can i suppress this setting ?
Kind regards,
Guido