Problems with autosize

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.

I have tested this fix out with version 7.5.2 and whilst the shape is now having its height set, it appears the calculation of the height (via CalculateTextSize() method) is incorrect.

To reproduce this please use the following code. When the worksheet is opened, you will notice the height of the shape is a bit too big. If you click on the shape in Excel you will see this. If you then go Format Shape/Text Box, and then click twice on "Resize shape to fit text", you will notice Excel re-sizes the Shape correctly, which are the dimensions that I would expect the Aspose CalculateTextSize() method would return. Could you see if there is a bug in the CalculateTextSize() method, or let me know if there is something wrong with the code below.

Thanks,

Mike

private void TextBoxShapeAutoHeightIssue()
{
Workbook testWorkbook = new Workbook();
Worksheet testWorksheet = testWorkbook.Worksheets[0];
Cells testCells = testWorksheet.Cells;
int iWidth = testCells.GetColumnWidthPixel(1);
iWidth += testCells.GetColumnWidthPixel(2);
Shape testShape = testWorksheet.Shapes.AddTextBox(1, 0, 1, 0, 0, iWidth);
testCells.SetColumnWidthPixel(5, 300);
testCells[15, 5].Value = "Text Box Height - After Creation";
testCells[15, 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 set the height of the TextBox correctly when the TextFrame.AutoSize property is set to true.";
testShape.Placement = PlacementType.Move;
testShape.IsLocked = false;
testShape.IsPrintable = true;
testShape.IsLocked = false;
testShape.IsLockAspectRatio = true;
testShape.IsTextWrapped = true;
testShape.LineFormat.IsVisible = false;
testShape.TextOrientationType = TextOrientationType.NoRotation;
testShape.TextHorizontalAlignment = TextAlignmentType.Left;
testShape.TextVerticalAlignment = TextAlignmentType.Top;
int[] size = testShape.CalculateTextSize();
// SET THE Height and Width as returned by .CalculateTextSize()
testShape.Height = size[1];
testShape.Width = size[0];
testCells[17, 5].Value = "Text Box Height - After Setting Properties";
testCells[17, 6].Value = testShape.Height;
testWorkbook.Save(@"C:\TextBoxHeightIssue.Xlsb", SaveFormat.Xlsb);
Process.Start(@"C:\TextBoxHeightIssue.Xlsb");
}

Hi,

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

We were able to observe this issue. The height of the textbox shape is bit too large and gets adjusted correctly if Resize shape to fit text is clicked twice. Please see the following screenshot for a reference.

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-41984.

Screenshot:

Hi Shakeel,

Just wondering how you are getting on with this issue and if there is any update.

Regards,

Mike

Hi Mike,


Please download and try our latest version/fix: Aspose.Cells for .NET v7.5.3.4 your issue should be fixed in it.

Let us know your feedback.

Thank you.

Many thanks again Amjad,

I have just smoked tested this one also and looks great. Thank you very much. I'll do a few more tests in the coming days.

Many thanks to you and your team.

Best regards,

Mike

Hi Mike,


Thanks for your feedback.

Good to know that your issue is resolved by the new fix/version: Aspose.Cells for .NET v7.5.3.4. 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.

Thank you.

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


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

Hi Amjad,

I have done some more testing on this issue and unfortunately it appears it is still problematic and has bugs.

Please see the attached code that demonstrates that the height is not always being set to the correct value, depending on fonts, formatting, justification etc.

Also it has shown up problems that the text boxes as they appear in Excel do not get rendered to either xps or pdf correctly (i.e., they can appear different in xps and pdf than Excel). This also can be seen in the attached code output.

This is a major issue for software I am about to release, so your earliest attention and resolution to these issues would be greatly appreciated.

Many Thanks,

Mike

Hi Mike,

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

We were able to observe this issue. CalculateTextSize does not return correct height of the textbox. We have attached the output files generated by your code to illustrate this issue. We have logged this issue in our database for investigation. 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-42104.

Hi Shakeel,

Just wondering how progress is going sorting this problem out.

This is a big issue for us, and any feedback you could give me as to a date of a likely resolution and a fix would be very much appreciated.

Look forward to hearing from you.

Cheers

Mike

Hi Mike,

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 in our database against this issue and requested the development team to provide some update or fix for this issue. Please spare us some time. Once, we will have some fix or update for you, we will let you know asap.

Have just downloaded and installed Aspose Cells 7.7.0.

I don’t think this has been fixed.

Could you please let me know when you expect a fix to be available.

Thanks,

Mike

Hi Mike,

Thanks for your posting and using Aspose.Cells.

Your issue logged as CELLSNET-42104 is not yet resolved. However, we have added your comment in our database and requested the development team to provide some ETA or update for this issue. Once, there is some news for you, we will let you know asap.

Hi Shakeel, is there any update on this issue…???

This is getting extremely critical for us.

As a possible work-around, does Aspose Cells implement the Excel Fill Justify tool…???

Look forward to hearing back from you.

Thanks,

Mike

Hi Mike,

Thanks for using Aspose.Cells.

It seems to be difficult issue and I am afraid, currently there is no update for you. However, I have again logged your comment and requested the development team to provide some ETA or update for this issue.

For your Excel justify tool question, please elaborate your question/feature more. We will look into it if such a feature is implemented by Aspose.Cells and let you know asap.

Hi Shakeel,

Re justify fill - it is a standard tool in Excel - best I refer you to this link to see the basics of what it does:

Regarding the outstanding issue, we are very disappointed that this bug has not yet been resolved and more so that there is no scheduled date for a resolution from Aspose.

This bug has been outstanding for some time now.

As mentioned previously, the method at issue returning correct results/values is a vital requirement for our application and critical for our users, and thus key to our reliance and continued use of Aspose Cells.

I would respectfully ask you to do everything you can to escalate this bug to the highest level and hopefully have fixed asap.

I look forward to your feedback and hopefully an expected date for the bug’s resolution.

Many thanks,

Mike

Hi Mike,

Thanks for using Aspose.Cells.

For this new feature (i.e using Justify tool in Excel), please create a new thread. We will look into it and see if such a feature could be implemented and update you asap.

Currently, your issue is logged as a Normal User. You can consider to purchase enhanced support (priority or enterprise support) and then your issue’s priority will be escalated to enhanced priority.

Please see the following link to see different priority options.

http://www.aspose.com/corporate/services/default.aspx

I have also requested the development team to look into your issue as soon as possible and once again logged your comment. Once, there is some fix or update for you, we will let you know asap.

Hi,


We also seem the have the same issue here.

We want to accomplish the following; we want to have a textbox shape on our first cell which has a fixed width and a variable height. The rows under this cell have some data in it. The input text should be completely displayed, make the textbox longer and should not overflow to the right. The cell should also grow vertically so the data is not overlapped with the shape.

In our input (attached) file already has the data and the textboxshape.

The I run this code*;

Dim objLicense As New Aspose.Cells.License()
objLicense.SetLicense(“Aspose.Cells.lic”)

Dim objWorkbook As New Workbook(“C:\input.xls”)

Dim objWorksheet As Worksheet = objWorkbook.Worksheets(0)

Dim objShape As Aspose.Cells.Drawing.Shape = objWorksheet.Shapes(“tb”)
objShape.Text = String.Format(“very long text the first line is the longest, longer, longer, very very long {0} not as long {0} even shorter {0} or was it”, vbCrLf)
objShape.TextFrame.AutoSize = True

objWorksheet.Cells.Rows(0).Height = objShape.CalculateTextSize()(1)

objWorkbook.Save(“C:\output.xls”, SaveFormat.Excel97To2003)

I observed the following;
- objShape.Height property is still the original height
- the objShape.CalculateTextSize function** returns an array of two variables of which (I assume) the first one is the new height. But this value was to large.

Please see the attached “output” file

Could you please provide a workaround or link us to the existing issue so we will also be up to date?

Also I would like the know why I do not get any data when I call the “LinkedCell” property of the objShape? I would have expected “A1”…

With warm regards,

Sjoerd van Loon
Senior Software Engineer
Infoland BV

* tested against aspose.cells 8.0.0
** I could not find any documentation about this function using google or the internal search of your website.