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

Free Support Forum - aspose.com

SheetRender.ToImage returns different images on different servers

When I run the attached XLSX file through SheetRender.ToImage, I end up with different output on different PCs, even when running exactly the same binaries. As you can hopefully see in the attachments, the output on one PC is considerably more pleasant than the output on the other.


There are only a couple of differences I can think of between the PCs on which I’ve tried this experiment. Specifically, the pleasant PC has MS Office installed and is running Windows 7. The garbled PC does not have Office and is running Server 2008.

Is there anything I can install or do to make the Server 2008 machine produce pleasant output? Can anyone explain more about why this might be happening? (Underlying differences in the GDI library or something, perhaps?)

I’m using Cells v7.1.1.0, but a similar thing happens with Document.RenderToSize as well.

Thank you very much for any help!

Hi,

Thanks for your posting and using the Aspose.Cells for .NET.

Probably, it is because of fonts.

However, please provide us your sample code. We will look into it and update you asap.

The C# 2.code we’re using follows.


   public class ExcelConverter
{
public void Convert(string input, string output)
{
new License().SetLicense(“Aspose.Total.lic”);
Workbook book = new Workbook(input);
Worksheet sheet = book.Worksheets[0];
     ImageOrPrintOptions options = new ImageOrPrintOptions();
     SheetRender render = new SheetRender(sheet, options);
     using (Bitmap src_bmp = render.ToImage(0))
     {
        using (Bitmap dest_bmp = new Bitmap(332, 430))
        {
           using (Graphics gr = Graphics.FromImage(dest_bmp))
              gr.DrawImage(src_bmp, 0, 0, 332, 430);
           dest_bmp.Save(output, ImageFormat.Png);
        }
     }
  }

}



Thank you for any help you can offer!

Hi,

We suggest you to set

ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageFormat = ImageFormat.Emf;

If the issue still exists, please convert your image to XPS and send both results to us

imgOptions.SaveFormat = SaveFormat.XPS;

Using the EMF format did change the output on the pleasant PC (both the default format and the EMF format were pleasant), but didn’t seem to change much on the garbled PC.


To save the files to XPS I did the following:

  options.SaveFormat = SaveFormat.XPS;
  SheetRender render = new SheetRender(sheet, options);
  render.ToImage(0, @"pleasant_output.xps");

The embedded font files are slightly different, but I don’t know enough about them to say how (or whether it really matters).


Thanks again for your continued attention!

Hi,

Thanks for your feedback.

We have logged this issue in our database. If we require some more information on your part, we will let you know.

Once, we have some update/fix relating to this issue, we will let you know asap.

This issue has been logged as CELLSNET-40378.

Hi,

As we mentioned earlier.

gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
gr.DrawImage(image, 0, 0, 332, 430);


We found it 's related to the default InterpolationMode between two PC.

Please set gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High to solve this issue.

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