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

Free Support Forum - aspose.com

Single word is splitted into two lines in Aspose rendered output

Hi,

When rendering an Excel sheet/cell to an image. I noticed a single word was divided which was inconsistent with the manual Copy/Paste in Office.

Code:
var workbook = new Workbook(@“test.xlsx”);
var options = new ImageOrPrintOptions
{
ImageFormat = ImageFormat.Emf,
OnlyArea = false,
TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
OnePagePerSheet = true,
Transparent = true
};
var sheet = workbook.Worksheets[0];

        sheet.PageSetup.PrintArea = "A1:A1";
        sheet.PageSetup.Zoom = 100;
        sheet.PageSetup.LeftMargin =
            sheet.PageSetup.RightMargin = sheet.PageSetup.TopMargin = sheet.PageSetup.BottomMargin = sheet.PageSetup.HeaderMargin = sheet.PageSetup.FooterMargin = 0;

        SheetRender render = new SheetRender(sheet, options);
        render.ToImage(0, @"out.emf");

I’ve attached the test files and a screenshot for your reference:
test.zip (28.1 KB)
screenshot.png (9.3 KB)

I have done some investigation myself and noticed the issue might come from that I font for each individual character in the cell. The reason for that was because in practice I need to set different font for different characters in a single cell, however the output image has become inconsistent with the Office behaviour because of this. Could you please look into this?

Thanks,

@ServerSide527,

Thanks for the template file, sample code and screenshot.

After an initial test, I observed the issue as you mentioned by using your sample code with your template file. I found that single word is splitted into two lines in Aspose.Cells’ rendered output image as per your screenshot. I have logged a ticket with an id “CELLSNET-46114” for your issue. We will look into it soon.

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

@ServerSide527,

As you said, you set font for each individual character. Then we will take the word “abc” as three words(“a”,“b”,“c”) instead of one word. You can set font for each individual word as a work around if possible.

I am afraid, we cannot fix it for now, considering some Asia words/characters can split at any character.

Hi,

Thanks for your reply.

This behaviour is inconsistent with Office manual copy/paste anyhow. MS Office was still able to recognise them as a word even if the character fonts have been set individually. As Aspose is expected to produce the same behaviour as Office, would there be a chance to have it corrected?

Thanks

@ServerSide527,

Well, generally (in most cases) Aspose.Cells follows MS Excel standards and specifications but sometimes MS Excel too produces incorrect or inconsistent results which may not follow certain rules. Anyways, I have logged your concerns against your issue “CELLSNET-46114” into our database. We will further evaluate your issue further.

Once we have any new information, we will share it with you.

@ServerSide527,

This is to inform you that we have fixed your issue “CELLSNET-46114” now. We will soon provide the fix after performing QA and including other enhancements and fixes.

@ServerSide527,

Please try our latest hotfix/version: Aspose.Cells for .NET v18.5.1, it should fix your issue:

Let us know your feedback.

Hi,

I have tested using this version and the issue doesn’t seem to exist anymore. Thanks very much for your help!

@ServerSide527,

Good to know that your issue is sorted out by the new version/fix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSNET-46114) have been fixed in Aspose.Cells for .NET 18.6. Please also check the document/article for your reference: https://docs.aspose.com/display/cellsnet/Installation