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

Free Support Forum - aspose.com

The word is renamed when converting to image

Hello team,

Thank you for your support.

PQ2366.zip (7.1 KB)
2.jpg (49.4 KB)

I have converted PQ2366.xls to image using Aspose 17.8 however an error has happened.
Please find error portion in 2.jpg.

  1. The word “系列1” has changed to “Series 1”

I have also attached PQ2366SaveAsPDFbyExcel.pdf which is a pdf MS Excel outputs correctly as a reference.
PQ2366SaveAsPDFbyExcel.pdf (31.0 KB)

This is my code

public static List ConvertExcelToImage(string docName, MemoryStream docStream, Dictionary<string, string> config)
{
try
{
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))
                Directory.CreateDirectory(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();
            license.SetLicense("Aspose.Total.lic");

            // 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 < sr.PageCount; i++)
                {
                    totalPageCount++;

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

                            // Add  PageInfo List
                            pageInfoList.Add(imgPath);
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                if (totalPageCount >= maxPageNum) break;
            }

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

They are parameters

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

               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,
PFU DSOL2

@PFU.DSOL2

We were able to observe this issue and logged it in our database for investigation and for a fix.

This issue has been logged as

  • CELLSNET-45628 - The word is renamed when converting to image

@PFU.DSOL2,

Please try our latest fix/version: Aspose.Cells for .NET v17.8.6:

Your issue should be fixed in it.

Let us know your feedback.

It works fine. Thank you.

@PFU.DSOL2

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

The issues you have found earlier (filed as CELLSNET-45628) have been fixed in Aspose.Cells for .NET 17.9.