Free Support Forum - aspose.com

Save to image functionality is not formatting correctly

we just upgraded to the Q3 2010 release of Aspose.Total. We have some existing code where we need to create a thumbnail image of the first page of some word, excel or powerpoint documents.

The way the thumbnail looks is not an exact reprensentation of the document in some cases and in others the save to an image functionality errors out altogether with an "object not defined" type error.

I have attached the original documents and the result thumbnails for your review.

here are code snippets of what we are doing for word and excel. These were taken from code examples you provided or from the your forum.

Document doc = new Document(inputname);
ImageSaveOptions options = new ImageSaveOptions(Aspose.Words.SaveFormat.Png);
options.PageCount = 1;
options.PageIndex = 0;
options.Resolution = 96;
doc.Save(outputname, options);

Workbook book = new Workbook();
book.Open(inputname);
Worksheet sheet = book.Worksheets[0];
//Convert the worksheet to image.
System.Drawing.Bitmap bitmap = sheet.SheetToImage();
//Save the image file specifying its image format.
bitmap.Save(outputname, System.Drawing.Imaging.ImageFormat.Png);

Hi Kirk,

Thanks for your inquiry.

I am a representative for Aspose.Words. I have taken a look at the Word documents you are rendering to image.

The document "BB9999_hzt379.doc" output appears overlapped or throws that exception because you are using alot of frames in your document. Currently Aspose.Words does not fully support frames upon rendering so this appears the output to appear differently. I have linked this to the appropriate issue. We will inform you when a fix is avaliable.

Regarding your second document "BB9999_kqk261.doc". The small parts of over lapping content is caused only due to the floating content in your document (the tables and the bottom image). Text wrapping around floating content upon rendering is not fully supported yet. We will inform you of any developments. In the mean time you can refactor your document to avoid floating objects. I have done this for you and sent the modified document to your inbox. This document appears properly when rendered now.

If there is anything else I can help you with, please feel free to ask.

Thanks,

Hi,

I am a representative of Aspose.Cells product. I have tested your Excel file “BB9999_mxx749.xls” and found an error “IndexOutOfRangeException” when trying to convert the sheet to images. I have logged your issue into our issue tracking system with an id: CELLSNET-20574. We will figure it out soon.

Moreover, just for your knowledge, please use SheetRender API instead of Worksheet.SheetToImage because we enhanced the SheetRender API for Sheet -to- Image feature, the older approach is not enhanced or polished which will be excluded soon and only SheetRender API would be retained.
See the document for your reference:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/generate-thumbnail-of-the-worksheet.html

Also, here is the sample code:
Workbook book = new Workbook(“e:\test\Book1.xls”);

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.ImageFormat = ImageFormat.Png;
//imgOptions.PrintingPage = PrintingPageType.Default;

Worksheet sheet = book.Worksheets[0];
SheetRender sr = new SheetRender(sheet, imgOptions);
for (int j = 0; j < sr.PageCount; j++)
{

sr.ToImage(j, “e:\test\My_sheetrender_test” + j + “.png”);
}


Thank you.

Hi,

Please try the attached version. We have fixed your issue regarding Excel file.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as WORDSNET-1940) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.