We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Out of position and arrows shape when converting image

Reference thread:

Hello team,

I have converted 0_34.xlsx to a image with Aspose.Cells. Please find error points with 0_34_00000001.jpg.

  1. Characters are out of position.
  2. Shape of arrows

This is my code.

public static List ConvertExcelToImage(string docName, MemoryStream docStream, Dictionary config)
var pageInfoList = new List();

// Get config setting
string docRootDir = config[“DocumentsFilePath”];
int dpi = int.Parse(config[“ImageDPI”]);
int thumbMaxH = int.Parse(config[“ThumbnailMaxHeight”]);
int thumbMaxW = int.Parse(config[“ThumbnailMaxWidth”]);
int maxPageNum = int.Parse(config[“DocumentMaxPageNum”]);
double readScale = double.Parse(config[“ImageReadScale”]);
int readDpi = Convert.ToInt32(dpi * readScale);

// Create images directory
string pageImgDir = docRootDir;
if (!Directory.Exists(pageImgDir))

// Get the encoder of JPEG
ImageCodecInfo jpgEncoder = GetCodecInfo();
//EncoderParameters encParams = GetEncoderParams();

EncoderParameters encParams = GetEncoderParams(int.Parse(config[“ImageJpegQuality”]));

// Instantiate the License class
Aspose.Cells.License license = new Aspose.Cells.License();

// Convert .doc and .docx file to PDF.
Workbook book = new Workbook(docStream);

//Define ImageOrPrintOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
//Specify the image format
imgOptions.ImageFormat = ImageFormat.Png;
imgOptions.VerticalResolution = readDpi;
imgOptions.HorizontalResolution = readDpi;

int totalPageCount = 0;
foreach (Worksheet sheet in book.Worksheets)
//Render the sheet with respect to specified image/print options
SheetRender sr = new SheetRender(sheet, imgOptions);

for (int i = 0; i

if (totalPageCount <= maxPageNum)
//Render the image for the sheet
string imgFile = string.Format("{0}_{1:D8}.jpg",
Path.GetFileNameWithoutExtension(docName), totalPageCount);
string imgPath = Path.Combine(pageImgDir, imgFile);
using (Bitmap bitmap = sr.ToImage(i))
// Export image file
bitmap.SetResolution(dpi, dpi);
bitmap.Save(imgPath, jpgEncoder, encParams);

// Export thumbnail file
//string thumbFilename = string.Format(@"{0}_thumb.jpg", Path.GetFileNameWithoutExtension(imgPath));
//string thumbPath = Path.Combine(Path.GetDirectoryName(imgPath), thumbFilename);
//float scale = (float)Math.Min((double)thumbMaxW / bitmap.Width, (double)thumbMaxH / bitmap.Height);
//int thumbW = System.Convert.ToInt32(bitmap.Width * scale);
//int thumbH = System.Convert.ToInt32(bitmap.Height * scale);
//using (Bitmap thumbBmp = new Bitmap(thumbW, thumbH))
// thumbBmp.SetResolution(dpi, dpi);

// using (Graphics graph = Graphics.FromImage(thumbBmp))
// {
// graph.DrawImage(bitmap, 0, 0, thumbW, thumbH);
// }
// thumbBmp.Save(thumbPath, jpgEncoder, encParams);

// TODO Create OCR XML

// Add PageInfo List

if (totalPageCount >= maxPageNum) break;

// return results with flag of max page limit over
return pageInfoList;

They are parameters.

// Get config setting
Create Appseting key value for async function
Dictionary config = new Dictionary();

config.Add(“DocumentsFilePath”, outDir);
config.Add(“ImageDPI”, “96”);
config.Add(“ImageReadScale”, “1.25”);
config.Add(“ThumbnailMaxHeight”, “252”);
config.Add(“ThumbnailMaxWidth”, “210”);
config.Add(“ImageJpegQuality”, “80”);
config.Add(“DocumentMaxPageNum”, “1000”);

Thank you,

This Topic is created by Amjad_Sahi using the Email to Eopic plugin.


Please try our latest version/fix: Aspose.Cells for .NET v17.6.1:
Aspose.Cells for .NET v17.6.1 (.NET 2.0)
Aspose.Cells for .NET v17.6.1 (.NET 4.0)

Your issue “CELLSNET-45387” should be fixed in it.

Let us know your feedback.

Thank you.


This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-45388”) now. We will soon provide you the fix (Download link (to new version) is shared in the thread) after performing QA and incorporating other enhancements and fixes.

Thank you.

The issues you have found earlier (filed as CELLSNET-45388) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

The issues you have found earlier (filed as CELLSNET-45388) have been fixed in this update.