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

Free Support Forum - aspose.com

Problems with autosize

Hello.

How i can know size of textbox after autosizing?

I use Aspose.Cells 4.4.1.3 for .NET with runtime 1.0.

Hi,

Thanks for considering Aspose.

You may utilize TextBox.Height / HeightCM / HeightInch / HeightPt and TextBox.Width / WidthCM / WidthInch / WidthPt properties for your need.

Aspose.Cells.TextBox textbox0 = worksheet.TextBoxes[0];
textbox0.Height = 60;
textbox0.Width = 100;

Thank you.

Amjad Sahi:
Hi,

Thanks for considering Aspose.

You may utilize TextBox.Height / HeightCM / HeightInch / HeightPt and TextBox.Width / WidthCM / WidthInch / WidthPt properties for your need.

Aspose.Cells.TextBox textbox0 = worksheet.TextBoxes[0];
textbox0.Height = 60;
textbox0.Width = 100;

Thank you.

Hello, thank you.

Please see my example code:

Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

TextBox textBox = worksheet.TextBoxes[worksheet.TextBoxes.Add(0, 0, 10, 15)];

textBox.Text = "TEST TEST TEST TEST \n TEST TEST TEST TEST \n TEST TEST TEST TEST";

textBox.TextFrame.AutoSize = true;

worksheet.Cells[5, 5].PutValue(textBox.Height);

worksheet.Cells[5, 6].PutValue(textBox.Height);

workbook.Save("TestWorkbook.xls");

You will see 10 and 15 values in cells after save workbook. Its wrong.

Hi,

I think when you set Automatic size for the text frame of a textbox, you cannot get the size of the text box, it is same as MS Excel.

Thank you.

Hi,
How much I know, in MS Excel after TextBox have been appropriated AutoSize = True in the future it is possible to learn its height and width.

Hi,

If you set AutoSize = True , we do not re-size the text box when you change the text. We only force MS Excel auto size the text box. We will look into this feature.

OK, Thank you.

Hi,

Just wondering if the AutoSize property has been fixed to AutoSize the text box.

If not, is there now any way to get the size of the TextBox once AutoSize has been set to true.

Thanks,

Mike

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

AutoSize issue has been fixed in the latest version: Aspose.Cells
for .NET v7.4.3.2
Please download and try it. It should work fine. If you encounter any issue, please feel free to let us know.

Hi,

I tried out the 7.4.3.2 DLL and still have the same problem.

I have attached some test code, and the resultant spreadsheet.

You will notice that the TextBox Height is still the Height it was created with,

and after setting the AutoSize property on the TextFrame of the Shape seems to have no impact.

As a result, it appears that it is not possible to get the correct (Auto Sized) Height of the

TextBox, which I need to be able to do, and also have the TextBox correctly displayed when opened in MS Excel.

Could you please let me know if this is still a problem or if there is an issue with my code (attached).

Thanks.

Hi,

Thanks for your sample code and using Aspose.Cells.

We were able to replicate this issue using your sample code. We have logged this issue in our database. We will look into it and resolve this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41685.

Hi Shakeel,

Just wondering if there has been any progress on this issue.

Thanks,

Mike

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We are afraid, your issue is still unresolved. We have added your comment in our database. Once, there is some update for you, we will let you know asap.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please try the following code with the new fix: Aspose.Cells
for .NET v7.4.3.4


C#


Workbook TestWorkbook = new Workbook();

Worksheet TestWorksheet = TestWorkbook.Worksheets[0];

Cells TestCells = TestWorksheet.Cells;

Shape TestShape = TestWorksheet.Shapes.AddTextBox(1, 0, 1, 0, 50, TestCells.GetColumnWidthPixel(1));


TestCells.SetColumnWidthPixel(5, 300);

TestCells[1, 5].Value = “Text Box Height - After Creation”;

TestCells[1, 6].Value = TestShape.Height;


MsoTextFrame TestTextFrame = TestShape.TextFrame;

TestTextFrame.BottomMarginPt = 0;

TestTextFrame.LeftMarginPt = 0;

TestTextFrame.RightMarginPt = 0;

TestTextFrame.TopMarginPt = 0;


// SET AUTO SIZE

// TestTextFrame.AutoSize = true;



TestTextFrame.IsAutoMargin = false;


TestShape.Text = “The TextBox in the created spreadsheet does not size the TextBox when the TextFrame.AutoSize property is set to true.”;

TestShape.Placement = PlacementType.Move;

TestShape.IsLocked = false;

TestShape.IsPrintable = true;

TestShape.IsLocked = false;

TestShape.IsLockAspectRatio = false;

TestShape.IsTextWrapped = true;

TestShape.LineFormat.IsVisible = false;

TestShape.TextOrientationType = TextOrientationType.NoRotation;

TestShape.TextHorizontalAlignment = TextAlignmentType.Left;

TestShape.TextVerticalAlignment = TextAlignmentType.Top;

int[] size = TestShape.CalculateTextSize();

TestShape.Width = size[0];

TestShape.Height = size[1];


TestCells[2, 5].Value = “Text Box Height - After Setting Properties”;

TestCells[2, 6].Value = TestShape.Height;

Hi Shakeel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have tried out version 7.4.3.4 and it does not seem to fix the issue.

The problem is that the shape's height does not get resized to the correct size.

As (in the test code see attached) when TestShape.IsTextWrapped is set to true, then the height of the Shape needs to be adjusted (not the width).

I am guessing that there may be an issue with CalculateTextSize - as it always seems to always return the size of the Text as if it is being fitted to one row (which won't necessarily be the case when wrapping the Text within the Shape)...i.e., regardless of the IsTextWrapped setting.

I have attached two spreadsheets.

The first is what happens when using version 7.4.3.4 and the test code - with AutoSize set to true and IsTextWrapped set to true.

The second spreadsheet is the same sheet, but manually edited (in MS Excel) to show the result one would expect. In this sheet, you will notice the TextBox is sized (across) the column width, but with the height adjusted to what it needs to be when using AutoSize and IsTextWrapped.

I hope this helps further explain the problem. Please get back to me if you require more details.

Look forward to getting this issue sorted out and hearing back from you on it.

Many Thanks

Mike

Hi,

Thanks for your posting and using Aspose.Cells.

You require autosize height wise while aspose is doing autosize width wise. We have noticed your requirements and logged it in our database. We will look into it and once there is some update for you, we will let you know asap.

Hi Shakeel,

I'm just wondering if there has been any more progress on this issue.

I am having trouble not being able to get the same effect as in MS Excel because the shape height is incorrect.

Many Thanks,

Mike

Hi,

Thanks for your posting and using Aspose.Cells.

We are afraid, there is no update for you at this moment. However, we have logged your comment against this issue. Please spare us some time. Once, we will have some update for you, we will let you know asap.

Hi,

We have fixed the issue.


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

Thank you.

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


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