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

Free Support Forum - aspose.com

Converting Office document contains auto shape objects to JPEG image

Hi support team,

We found some problems in converting excel files to JPEG file. Some auto shape objects such as arrows and balloons disappear or shift from correct position.

Could you tell us any workarounds or precautions when we create Office documents? For example:

- You must not use some kinds of auto shape objects or format settings.

- You must not reverse the direction of balloon objects.

Thank you,

Takehiro Nakamura

Hi,


Thanks for providing us details.

Could you share your template Excel file and paste your sample code here, we will check your issue soon.

Thank you.
Hello Amjad,

I have attached the file.

This is our code
----
private PageListResult ConvertExcelToImage()
{
try
{
var pageResultList = new List();

// Instantiate the License class
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense("Aspose.Total.lic");

var pageImgDir = CreateTempDirectory();

// Convert .xls and .xlsx file to PDF.
Workbook book = new Workbook(this._stream);

//Define ImageOrPrintOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions()
{
ImageFormat = ImageFormat.Png, //Specify the image format
VerticalResolution = this.config.ImageReadDpi,
HorizontalResolution = this.config.ImageReadDpi
};

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 > this.config.DocumentMaxPageNumber)
break;

using (Bitmap bitmap = sr.ToImage(i))
{
var imgPath = ExportImageFile(pageImgDir, totalPageCount, bitmap);

var thumbPath = ExportThumbnailFile(imgPath, totalPageCount, bitmap);

var pageResult = new PageResult(totalPageCount, imgPath, thumbPath);
pageResultList.Add(pageResult);
}
}

if (totalPageCount >= this.config.DocumentMaxPageNumber) break;
}

return new PageListResult(pageResultList, this.config.DocumentMaxPageNumber < totalPageCount);
}
catch (Exception ex)
{
throw new Exception("Failure converting excel", ex);
}
}
----

Takehiro and me are in a same team.

Best regards,
Atsuo Nakatani

Hi Atsuo,


Thank you for sharing the sample spreadsheet.

We have evaluated the presented scenario while using the following piece of code against the latest version of Aspose.Cells for .NET 17.02.1. We have noticed that the auto shapes from the worksheet “Sample” have not rendered correctly to image whereas all objects from the worksheet “Sample2” have rendered correctly (please check attached resultant images for confirmation).

In order to further investigate the case for the worksheet “Sample”, we have raised the incident as CELLSNET-45159 in our bug tracking system. Please spare us little time for the proper analysis. In the meanwhile, we will keep you posted with updates in this regard.

C#

Workbook book = new Workbook(dir + “sample2.xlsx”);
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions()
{
ImageFormat = ImageFormat.Png, //Specify the image format
VerticalResolution = 300,
HorizontalResolution = 300
};

int totalPageCount = 0;
foreach (Worksheet sheet in book.Worksheets)
{
SheetRender sr = new SheetRender(sheet, imgOptions);
for (int i = 0; i < sr.PageCount; i++)
{
totalPageCount++;
using (Bitmap bitmap = sr.ToImage(i))
{
bitmap.Save(dir + sheet.Name + i + “output.png”);
}
}
}

Hello Babar,



Thank you for your support.



It seems that there are some problems in the sample20output.



(1) hair color

(2) Ear color

(3) tie color

(4) angle

(5) word number in a line



I have pointed the error portion in the attached file.



Thank you,

Atsuo

Hi Atsuo,


Thank you for sharing your feedback.

I am able to notice the issues from 1 to 4 and have raised them in our database as follow.

  • CELLSNET-45160: Portions of the picture in spreadsheet have rendered in different color.
  • CELLSNET-45161: Angle of the picture in spreadsheet is slightly different.

Regarding the problem mentioned under the number 5, if my understanding is correct, you are concerned about the character <span style=“font-family: “Meiryo UI”; font-size: 11pt;”>等 which has rendered in the 1st line of the shape object as opposed to Excel view. I believe the said issue has be caused due to the missing font “Meiryo UI” which has been used to format the aforementioned character in Excel. Please note, when a particular font is not present at the time of rendering, the Aspose.Cells APIs try to substitute the missing font with any available font that could render the glyph, consequently the shape and size of the contents change. In this case, the Aspose.Cells APIs have used the PGothic font which can be confirmed by rendering the spreadsheet to PDF format where the embedded fonts can be checked from the Fonts tab of the Document Properties. I will try to acquire the missing font and reevaluate the case. In the meanwhile, could you please check the case on your side if you have the aforementioned font available in your system?

Hello Babar,



Thank you for your support.



Regarding number-5, we will also check the missing font.



I have pointed error potion in sample0output for confirmation.



(1) invert (word and right alignment)

(2) shape



Thank you,

Atsuo

Hi Atsuo,


Thank you for writing back.

First of all, please note that I have moved this thread to Aspose.Cells support forum because all of your concerns are related to Aspose.Cells APIs. In case you have any issues regarding other Aspose APIs, we would suggest you to create new thread(s) in respective forum(s) or post your concerns in new thread in Aspose.Total support forum.

Regarding your recent concerns, I have reevaluated the cases against the latest version of Aspose.Cells for .NET 17.02.2, and I am able to notice both mentioned problems. Please note, the issue related to the shape (2 from the recent list) has already been recorded as CELLSNET-45159. For the problem related to inverted text and alignment (1 from the recent list), I have raised the problem as CELLSNET-45163 in our bug tracking system. We will soon further analyze all of the mentioned issues on our side, and share the findings here for your reference.
Hi again,

atnk:
It seems that there are some problems in the sample20output.
(5) word number in a line

This is to update you regarding the problem as quoted above. I am able to acquire the Meriyo font, and I have retested the case after installing it on my system. Please check the attached resultant image as well as a comparison snapshot. You will notice that the contents have rendered correctly now, that confirms, the said issue is only caused due to the missing font.

Hello Babar,

Thank you for your update.

I appreciate for your great support.

Regards,
Atuso

Hi again,


This is to update you regarding the tickets attached to this thread. Please note, most of the tickets are currently in progress, and we hope to provide a hotfix during the upcoming week. One of the tickets (CELLSNET-45160) has been postponed to a later date because the Aspose.Cells APIs are currently incapable of rendering the ink objects such as hair, eyes and tie (from your sample). We will keep the aforementioned ticket open till we implement the said feature.

Hello Babar,



Thank you very much for your update. That is very useful for us.



This is a minute thing, but I would like to confirm one more point.



I have attached file. We can see (1) some margin in your comparison image.

I would like to confirm if there is a specification.



Thank you,

Atsuo

Hi Asuo,


Thank you for writing back. I have evaluated the recently shared scenario while using the latest version of Aspose.Cells for .NET 17.02.4, and I am able to notice the extra space around the contents of the shape “角丸四角形吹き出し 1”. I have raised this incident as CELLSNET-45180 in our bug tracking system for further investigation.

That said, please give a try to the latest version on your side as I believe a few of the mentioned issues have been fixed with this revision.

The issues you have found earlier (filed as CELLSNET-45163;CELLSNET-45161;CELLSNET-45159) have been fixed in Aspose.Cells for .NET 17.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

@atnk

Please download and try the following fix for your issue CELLSNET-45159 and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-45160) have been fixed in Aspose.Cells for .NET 18.6. Please also check the document/article for your reference: https://docs.aspose.com/display/cellsnet/Installation