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

Free Support Forum - aspose.com

Sheet to image - superscript and subscript shifted up too much in .NET

Hi,

When using SheetRender.ToImage to generate image from Excel range the superscript and subscript text is shifted up too much (please see the attached image).
For reproducing the issue please use the attached Excel file and the following code:

var workbook = new Workbook(“29859.xlsx”);

workbook.Worksheets[0].PageSetup.TopMargin = 0;
workbook.Worksheets[0].PageSetup.LeftMargin = 0;
workbook.Worksheets[0].PageSetup.RightMargin = 0;
workbook.Worksheets[0].PageSetup.BottomMargin = 0;

workbook.Worksheets[0].PageSetup.PrintArea = “A3:S6”;

var sheetRender = new SheetRender(workbook.Worksheets[0], CreateImageOptions());
var image = sheetRender.ToImage(0);

image.Save(“output.png”);

private static ImageOrPrintOptions CreateImageOptions()
{
return new ImageOrPrintOptions
{
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true,
OnlyArea = true
};
}


Best regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi,


Thanks for the template file, sample code and screen shot.

After an initial test, I observed the issue as you mentioned. I found that the superscript and subscript data/text shifted up too much when generating image using SheetRender.ToImage method as per your screen shot attached. I used your sample code with your template file to reproduce the issue:
e.g
Sample code:

var workbook = new Workbook(“e:\test2\29859.xlsx”);
workbook.Worksheets[0].PageSetup.TopMargin = 0;
workbook.Worksheets[0].PageSetup.LeftMargin = 0;
workbook.Worksheets[0].PageSetup.RightMargin = 0;
workbook.Worksheets[0].PageSetup.BottomMargin = 0;
workbook.Worksheets[0].PageSetup.PrintArea = “A3:S6”;
var sheetRender = new SheetRender(workbook.Worksheets[0], CreateImageOptions());
var image = sheetRender.ToImage(0);
image.Save(“e:\test2\out1.png”);



private ImageOrPrintOptions CreateImageOptions()
{
return new ImageOrPrintOptions
{
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true,
OnlyArea = true
};
}

I have logged a ticket with an id “CELLSNET-43854” for your issue. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.


Hi Aurelian,

This is to inform you that we have fixed the problem logged earlier as CELLSNET-43854. We will shortly provide the fix here after incorporating other enhancements and performing QA. As soon as the next release is available for public use, we will notify you here in reference to the aforesaid ticket.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.5.2.2 and let us know your feedback.

Hi,

Thank you for the fix. However we cannot test this build, we have to wait for the .NET framework 4 version of your code.

Thanks!

Hi,


In that case, you have to wait for a couple of weeks or so when we will release our next official version of the product i.e, Aspose.Cells for .NET v8.6.0.

Thank you.

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


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