AutoFitRow loops endlessly

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

AutoFitRow loops endlessly

Postby detern » Mon Jun 11, 2012 12:57 pm

Hi,
after exporting Data to XLS, we have an optional String that can be inserted as content for the first cell. Then the cell is formatted in a special way.
When this is done, we call AutoFitRow(1). This call never comes back and seems to loop. AutofitRow(1,1,1,false) behaves the same way.
This is the original code:
Code: Select all
       
if (!String.IsNullOrEmpty(mAdditionalInfo))
{
    sheet.InsertRow(1);
    sheet[1, 1].Text = mAdditionalInfo;
    sheet[1, 1].Style.Font.IsBold = true;
    sheet[1, 1].Style.Font.Size = 14.0;
    sheet[1, 1].Style.Font.Underline = FontUnderlineType.Single;
    sheet.AutoFitRow(1);
}

If I remove sheet.AutoFitRow(1) everything ends correctly (except for the 1st row not being high enough :lol: ).
Is it a bug or am I doing sth. wrong?

Greetings
Detlef
detern
 
Posts: 3
Joined: Tue May 22, 2012 11:44 am

Re: AutoFitRow loops endlessly

Postby nancy » Tue Jun 12, 2012 6:40 am

Hi detern,

I can't retrieve your problem, and I use the following code:
Workbook workbook1 = new Workbook();
Worksheet sheet1 = workbook1.Worksheets[0];
sheet1.InsertRow(1);
sheet1[1, 1].Text = "helloggggggggggggggg";
sheet1[1, 1].Style.Font.IsBold = true;
sheet1[1, 1].Style.Font.Size = 20.0;
sheet1[1, 1].Style.Font.Underline = FontUnderlineType.Single;
sheet1.AutoFitColumn(1);
//sheet1.AutoFitRow(1);
sheet1.AutofitRow(1,1,1,false);
I think these codes is correst and the problem result from other things.
I suggest that you check the input parameter in your function. If you can't
solve the problem, please tell me more information about your codes and
so on.

Best wishes to you! Happy work! :lol:
------------------------------------------------------------------------------------------------
Nancy,
e-iceblue support
Nancy
e-iceblue support team
contact: nancy.wang@e-iceblue.com
User avatar
nancy
 
Posts: 51
Joined: Wed May 30, 2012 2:02 am

Re: AutoFitRow loops endlessly

Postby detern » Tue Jun 12, 2012 9:12 am

Hi nancy,
it was hard, but I found out when this happens. Was a little hard to investigate, but finally it seems that it depends on the string. If the string contains a linefeed ("\n") AND a capital letter somewhere, it will happen.
sheet1[1, 1].Text = "this string may contain a linefeed or not"; => works!
sheet1[1, 1].Text = "this string may contain a \nlinefeed or not"; => works also!
but
sheet1[1, 1].Text = "This string may contain a \nlinefeed or not"; => FAILS!

Detlef
detern
 
Posts: 3
Joined: Tue May 22, 2012 11:44 am

Re: AutoFitRow loops endlessly

Postby nancy » Wed Jun 13, 2012 5:02 am

Hi Detlef,

Thank you for your reporting this problem. We will fix it in next version and inform you. We suggest that you use the method "sheet.AutoFitColumn()" when the string contains character '\n'. It is safe and reliable.

Best wishes to you! Happy work! :lol: :)
--------------------------------------------------------------------------------------------------------------------------------
nancy,
e-iceblue support
Nancy
e-iceblue support team
contact: nancy.wang@e-iceblue.com
User avatar
nancy
 
Posts: 51
Joined: Wed May 30, 2012 2:02 am

Re: AutoFitRow loops endlessly

Postby nancy » Wed Jul 11, 2012 9:35 am

Hi detern,

About your problem, we have fixed in Spire.XLS Pack Version:6.8 .You can download the newest version. From the URL:http://www.e-iceblue.com/Download/download-excel-for-net-now/spire-xls-v68.html

If you still have any problems, please contact us! Thank you for your cooperation and understanding.
Nancy
e-iceblue support team
contact: nancy.wang@e-iceblue.com
User avatar
nancy
 
Posts: 51
Joined: Wed May 30, 2012 2:02 am


Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 1 guest