AutoFitRow in Aspose.Excel version 1.9.1.1


#1

Dose AutoFitRow works in the latest version ?

In my excel file, Cell A1 has Text Control “Wrap Text” activated.

I use this code to put value and use AutoFitRow


Dim myExcel As Aspose.Excel.Excel
myExcel = New Aspose.Excel.Excel
myExcel.Open(“c:\temp\nima.xls”)

Dim tmp As String = “Hi” & vbNewLine & “Today is” & vbNewLine & “Monday” & vbNewLine & "Bye"
tmp = Replace(tmp, vbNewLine, Chr(10), 1, -1, vbTextCompare)
tmp = Replace(tmp, Chr(13), Chr(10), 1, -1, vbTextCompare)

myExcel.Worksheets(“Sheet1”).Cells(“A1”).PutValue(tmp)
myExcel.Worksheets(“Sheet1”).AutoFitRow(1)


However in my excel file, Row 1 has’nt change the row size.
I tried also with

myExcel.Worksheets(“Sheet1”).AutoFitRow(0)

But without any result.


#2

Cell A1 is a merged cell, right? In MS Excel, autofit doesn’t take effect on merged cells, so is Aspose.Excel.


#3

Hi

No

Cell A1 is not a merged cell.
The only properties I have in this cell is that I have activated “Wrap text”


#4

Hi nima,

Please download the latest hotfix and have a try.


#5

Hi

Still some problem.
How do you calculate Row Height ?

When I have 4 row in my cell, Autofitrow method change the cell height to fit for 2 rows.


#6

What’s the string in your cell? Could you post it here?

And if possible, could you send the file to me?

Thanks.


#7

Hi

I am using Aspose.Excel Version 1.9.1.3

here is the code that I use :


Dim myExcel As Aspose.Excel.Excel, mySheet As Aspose.Excel.Worksheet

myExcel = New Aspose.Excel.Excel
myExcel.Open("…\nima.xls")
mySheet = myExcel.Worksheets(“Sheet1”)

Dim tmp As String = “hej” & vbNewLine & “har” & vbNewLine & “mar” & vbNewLine & “du”
tmp = Replace(tmp, vbNewLine, Chr(10), 1, -1, vbTextCompare)
tmp = Replace(tmp, Chr(13), Chr(10), 1, -1, vbTextCompare)

mySheet.Cells(“A1”).PutValue(tmp)
mySheet.AutoFitRow(mySheet.Cells().CreateRange(“A1”,“A1”).FirstRow)

myExcel.Save("…\nima2.xls",Aspose.Excel.FileFormatType.Default)


I will send nima.xls and nima2.xls via email to you


#8

Hi nima,

I got your file and found the problem. It will be fixed before the end of April. Now thanks for your patience.


#9

Any hotfix about this bug ?


#10

Hi nima,

Sorry for the delay. I am working on this issue but it’s really a complex problem. So you have to wait for another one week. Thanks for your patience.