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

Free Support Forum - aspose.com

Unable to detect length of Shape if text is is too big

Hi,
I use the following sample code to set the length of the height of the shape…

     worksheet.Shapes[shapeNameText.Key].Text = shapeNameText.Value;
            var height = worksheet.Shapes[shapeNameText.Key].CalculateTextSize()[1];
            ////TODO Aspose Bug for Japanese ticker
            worksheet.Shapes[shapeNameText.Key].Height = height;

However, it seems the maximum height of the shape for the text(please find in the attachment) is to row 143… when user opened the excel, there is still lots of text hidden.
Example of the hidden text in the shape as below…

image.png (23.6 KB)

image.png (29.7 KB)

after double click the shape, we can see those hidden text.
JapaneseDisclosure.zip (163.7 KB)

If the language is English, there is no issue. Seems Aspose is not able to detect Japanese text height?

@catalparue26,
Please share the complete runnable console application which can be compiled without any missing reference. Share the expected output file generated by MS Excel for our reference along with the snapshots displaying the difference between the program output and expected output. We will reproduce the scenario here and provide assistance accordingly.

hi, please see the attachment as the console application which can be compiled.

After compiling, the japanesediscolsure shape is hidden…
image.png (44.0 KB)

the englishdisclosure shape is too large…
image.png (44.2 KB)

We believe the following line: CalculateTextSize()[1]… is ASPOSE BUG
// Aspose BUG
var height = worksheet.Shapes["__la_DisclaimerFront"].CalculateTextSize()[1];
worksheet.Shapes["__la_DisclaimerFront"].Height = height;
// Aspose BUG

I expect Aspose CalculateTextSize() can calculate shape high correctly. Not too large or hide any text.

Hi, seems Aspose package is too big… hence i remove Aspose package in the application.
The issue is if the text is too big… Aspose CalculateTextSize() will return wrong value.

AposeJapaneseShapeIssueExample - Copy.zip (228.8 KB)

@catalparue26,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-47296 – Text height for long text in Japanese and other languages not calculated properly

thanks. the issue is not only Japanese, but English disclosure… (the solution i send also include English text). I think once the text is too big… Aspose is not able to detect the height properly.

@catalparue26,
Thank you for this information. We have added this information with the ticket for our reference.

@catalparue26,

  1. Could you share “Connections Cond Light” Font file with us.
  2. Please show us the result of worksheet.Shapes["__la_DisclaimerFront"].CalculateTextSize()[1]
  1. I am not able to find ‘Connections Cond Lingt’ from our window system… maybe it is embedded on excel?
  2. Result - Japanese Text: 1943 , English Text: 2209

@catalparue26,
Thank you for the feedback. We have recorded it along with the ticket for our future reference.

@catalparue26,
Please install “Connections Cond Light” font or change the font the text box, otherwise MS Excel will automatically use another font to display the text box.
Aspose.Cells works fine for setting the height of the shape with Shape.Height.The height is 22.25 inch in MS Excel, it is same as setted 1943 pixels.

hi, thanks for the response. Do you mean this only happen because of the “font” is not installed?
Which “font” you tested ? (the one return 22.25 inch in Excel)

@catalparue26,
Yes the height changes when MS Excel uses another font. Please install “Connections Cond Light” font and let us know your feedback.

Hi, I do not have Connection Cond Light installed in my machine. Hence I change font to ‘Calibri’ on original disclosure sheet. (I believe you also have Calibri installed in your machine) and rerun… it is still not working…
Please see the attachment file as the disclosure sheet which I change font to “Calibri”.
JapaneseDisclosureExample.zip (194.2 KB)

@catalparue26,
Thank you for the feedback. We have recorded this information with the ticket and will analyze it soon.

@catalparue26,
Please set the correct font for Japanese characters. ‘Calibri’ could not be applied for Japanese.

can you let me know what is the correct font for japanese characters? i used Calbri, it is not working on English version as well! Have you used Calbri to test English disclosure?

@catalparue26,
Please try with MS Gothic font and let us know your feedback. In general, “MS xyz” should all be Japanese fonts.