Free Support Forum - aspose.com

Excel does not export to image

Hello,

I am facing two issues, in the first the XLSM file does export but it does not show anything (a blank image), while there is a single word in the worksheet.

In the second file, it generates a NULL bitmap when exporting the worksheet using Sheetrender. My code is below (taken from the website example code itself)

ImageOrPrintOptions options = new ImageOrPrintOptions();
options.HorizontalResolution = 100;
options.VerticalResolution = 100;
options.IsCellAutoFit = false;
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
options.PrintingPage = PrintingPageType.Default;
options.OnePagePerSheet = true;

Worksheet sheet = book.Worksheets[0];
SheetRender sr = new SheetRender(sheet, options);

using (MemoryStream ms = new MemoryStream())
{
sr.ToImage(0, ms);
// ms has zero length.
}

The files are also attached. Any inputs are most welcome!

Thanks,
Jay

Hi Jay,

For your first issue regarding Book1.xlsm, I have tested it with the latest fix/version: Aspose.Cells for .NET v7.3.3.2 it works fine. The output png image is fine having the word in the cell.

However, testing your second issue regarding “Test22.xlsx” file, I am able to reproduce the issue on our end. We have logged your issue (logged as: “CELLSNET-41176”) into our database. We will soon look into it to figure it out.

Thank you.

Hi,


After looking your second issue further, we come to know that in your workbook (“Test22.xlsx” file) there are total 5 worksheets and there are 3 worksheets which are set as “VeryHidden” (you may see them in Visual Basic Editor in MS Excel). So when you use the line:
Worksheet sheet = book.Worksheets[0];
it is actually referring to the veryhidden worksheet at indexed position “0”, Please use name instead of index. See the sample code below that works absolutely fine (using v7.3.3.2) with your template “Test22.xlsx”.

Sample code:

Workbook book = new Workbook(“e:\test2\Test22.xlsx”);
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.HorizontalResolution = 100;
options.VerticalResolution = 100;
options.IsCellAutoFit = false;
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
options.PrintingPage = PrintingPageType.Default;
options.OnePagePerSheet = true;

Worksheet sheet = book.Worksheets[“Feuil2”];
SheetRender sr = new SheetRender(sheet, options);
sr.ToImage(0, “e:\test2\myoutputexcel2.png”);


In short, it is not an issue with the product, so we have closed your ticket: “CELLSNET-41176” now.
Thank you.

Hello Amjad,

For the second sheet, I will check for the hidden sheet issue that you have suggested.

However
for first, I do get export image, but that is not containing all data.
If you see the second right “test” word, it is not seen in the export, also
the hyperlink is having the underline stretching out of the text. Also the text formatting is not maintained, the top “test” word is center aligned vertically, however export does not show that way.

Please use the new attachment new_Book1, also the export image is attached. I am using the latest version of cells as you suggested.

Thanks,
Jay

Hi,

Thanks for your posting and using Aspose.Cells.

Please download and try the latest version:
Aspose.Cells for .NET (Latest Version) . It should work fine.

We have tested your issue with the latest version and did not find any issue. Please see the following test code. I have attached the output image generated by it for your reference.

As you can see all the data is showing on the output image fine.

C#


Workbook workbook = new Workbook(path);


Worksheet worksheet = workbook.Worksheets[0];


//Apply different Image / Print options.

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

options.OnePagePerSheet = true;

options.ImageFormat = ImageFormat.Png;


SheetRender sr = new SheetRender(worksheet, options);

Bitmap bitmap = sr.ToImage(0);

bitmap.Save(path + “.out.png”, ImageFormat.Png);

Output Image:

Hello Shakeel,

Thanks, the other issues are fixed with using latest release. However the underline below hyperlink is still extending. It is seen in your export image too.

Thanks,
Jay

Hi,


I have tested your case and am able to reproduce the issue as you pointed out. I used your template file to produce the output image. I can notice the issue regarding hyperlinks, the underline (for the hyperlink) is stretched a bit.

I have logged a ticket with an id: CELLSNET-41181 for your issue. We will look into your issue soon.

Thank you.

Hi,

Thanks for using Aspose.Cells for NET.

Please download and try this fix: Aspose.Cells for .NET (Latest Version) .

We have partially solved the issue with the alignment.

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


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