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;