Hi,
we use following code to create pictures from Excel:
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(@“Aspose.Total.lic”);
Workbook wb = new Workbook(“Excel_V1.xlsx”);
Worksheet excelWorksheet = wb.Worksheets[“Biedronka 1”];
string rangeName = “BIPLI_C2_VENDAS_LIQ_BRIEDRONKA_PT”;
CellsHelper.DPI = 96;
Aspose.Cells.Range range = wb.Worksheets.GetRangeByName(rangeName);
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.Png;
options.OnePagePerSheet = true;
options.HorizontalResolution = 600;
options.VerticalResolution = 600;
options.OnlyArea = true;
Aspose.Cells.PageSetup pageSetup = excelWorksheet.PageSetup;
//set margins to zero.
pageSetup.LeftMargin = 0;
pageSetup.RightMargin = 0;
pageSetup.TopMargin = 0;
pageSetup.BottomMargin = 0;
pageSetup.PrintArea = rangeAddress;
SheetRender sr = new SheetRender(excelWorksheet, options);
using (MemoryStream imageStream = new MemoryStream())
{
sr.ToImage(0, imageStream);
System.IO.File.WriteAllBytes("image.png", imageStream.ToArray());
}
The pillars are uncomplete on the image. Compare with range in Excel.
I add the content
Debug.zip (174.5 KB)
Kind regards,
@Nachti