Problems with Textbox Autosize

Hi,


i think i have the same problem as described in this topic. Attached is an example, i tried a lot of things but it isn’t really working. If i click twice on “Resize shape to fit text” or once on “Allow text to overflow shape” (Somehow the Checkbox value is Indeterminate after clicking its false) then the textbox is shown correctly in Excel.

Sincerely yours,

Willem-Jan

Hi Willem,

Thank you for providing your sample project.

Although your presented scenario is similar to this post but it still needs an independent and through investigation, therefore I have split the existing thread to create a new one on your behalf. Moreover, I was able to replicate the issue of Textbox sizing while using the latest version of Aspose.Cells for .NET 7.7.0, so a ticket (CELLSNET-42235) has been logged in this reference, and has been attached to this thread for automated notifications. Please spare us little time to properly analyze the problem cause on our end. In the meanwhile, we will keep you posted with updates in this regard.

Hi Willem-Jan,

Thanks for using Aspose.Cells.

We are afraid ”Resize shape to fit size” is not supported now. It’s too complex. We cannot implement in short time. Thanks for your understanding.

Hi,

Please try our new version/fix: : Aspose.Cells for .NET v8.0.1.3 You can resize the text using following codes.

  1. Set IsTextWrapped to false. Don’t specify limited scope, the text will not be wrapped until it meets newline character.
    e.g.
    Sample code:
textBox.TextFrame.AutoSize = true;

textBox.IsTextWrapped = false;

int[] size = textBox.CalculateTextSize();

textBox.Height = size[1];

textBox.Width = size[0];
  1. Set IsTextWrapped to true. At the same time set width of the shape. CalculateTextSize() method will ensure the text don’t extend out of the fixed width and the height is a variable value.
    e.g.
    Sample code:
textBox.TextFrame.AutoSize = true;

textBox.IsTextWrapped = true;

//If IsTextWrapped is true, must set the width of shape to a proper fixed value.

//In this case, CalculateTextSize()[0] is equals shape.Width.

textbox.Width = 400;

int[] size = textBox.CalculateTextSize();

textBox.Height = size[1];

textBox.Width = size[0];

Thank you.

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


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