SheetRender draws textbox contents bold

Hello! I have a workbook containing a text box. When rendering a range containing the text box to image, the text inside the text box is bold. Please, check the attachment!

Thank you.

Hi,

Thanks for sharing the project.

I can find the issue as you have mentioned by using your template file with the sample code. In the output image, the textbox's content is bold which it should not be.

Sample code:

var workbook = new Workbook(@"E:\test2\TextBoxInExcel\TextBoxInExcel\TextBold2.xlsx");

var imageOptions = new ImageOrPrintOptions
{
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true
};

var worksheet = workbook.Worksheets[0];

worksheet.PageSetup.PrintArea = string.Format("a1:e6");
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.BottomMargin = 0;

var sheetRender = new SheetRender(worksheet, imageOptions);

sheetRender.ToImage(0, @"E:\test2\TextBoxInExcel\TextBoxInExcel\output.png");

I have logged a ticket with an id: CELLSNET-40901. We will soon look into it to figure it out.

Thank you.

Hi,

We have fixed this issue.

Please download and try this fix: Aspose.Cells for .NET v7.3.0.3 and let us know your feedback.

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

Hi! This is still present in Aspose Cells 7.3.2.

Thank you,

Dragos Culea

Hi,

Thanks for your feedback.

We have reopened this issue. We will get back to you after fixing this issue.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\TextBoxInExcel\TextBoxInExcel\TextBold2.xlsx”;


var workbook = new Workbook(filePath);


var imageOptions = new ImageOrPrintOptions

{

Quality = 100,

VerticalResolution = 200,

HorizontalResolution = 200,

PrintingPage = PrintingPageType.IgnoreBlank,

ImageFormat = ImageFormat.Png,

OnePagePerSheet = true

};


var worksheet = workbook.Worksheets[0];


worksheet.PageSetup.PrintArea = string.Format(“a1:e6”);

worksheet.PageSetup.TopMargin = 0;

worksheet.PageSetup.LeftMargin = 0;

worksheet.PageSetup.RightMargin = 0;

worksheet.PageSetup.BottomMargin = 0;


var sheetRender = new SheetRender(worksheet, imageOptions);


sheetRender.ToImage(0, filePath + “.out.png”);


Output Image:

Hi,


After looking into your issue further, we are afraid, we do not have better way to cope with it. The issue (text/data of Text box is bold in the rendered PDF page) is due to the measurement of character string inaccurate, the issue is regarding Graphic.measureString(); this API of GDI+ has an issue in it which results in your issue as well (same as per your other thread: http://www.aspose.com/community/forums/416625/excel-text-box-is-resized-incorrectly-when-rendering-to-image/showthread.aspx#416625).

We actually fixed the Text box’s border issue in it but could not fix the bold text issue.

Anyways, we may look into it further after some time. If we have any update or solution or other way around, we will let you know here.

Sorry for any innocence caused!

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


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