We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

AutofitRows() on merged cells

Quite simply, it doesn''t seem to work. The cells that result from the following code are, indeed, merged and the text in them is wrapped. However, they are only the default height when the text inside at least 2 lines worth. ... workSheet.Range[rowIndex,3,rowIndex,9].Text = message; workSheet.Range[rowIndex,3,rowIndex,9].Merge(); workSheet.Range[rowIndex,3,rowIndex,9].WrapText = true; workSheet.Range[rowIndex,3,rowIndex,9].AutofitRows(); ...

2 Replies

AD Administrator Syncfusion Team April 4, 2005 07:53 PM UTC

Hi Najati, Could you please explain on what you meant by "However, they are only the default height when the text inside at least 2 lines worth.". I tested for this behavior by Autofitting the row in MS Excel but it does not seems to work on Merged cells. Please let me know if I am missing something. Thanks, Stephen. >Quite simply, it doesn''t seem to work. The cells that result from the following code are, indeed, merged and the text in them is wrapped. However, they are only the default height when the text inside at least 2 lines worth. > >... >workSheet.Range[rowIndex,3,rowIndex,9].Text = message; >workSheet.Range[rowIndex,3,rowIndex,9].Merge(); >workSheet.Range[rowIndex,3,rowIndex,9].WrapText = true; >workSheet.Range[rowIndex,3,rowIndex,9].AutofitRows(); >... >


NI Najati Imam April 5, 2005 03:06 PM UTC

I just meant that when the row should be taller to account for the wrapped text, it was not taller, and instead just the default row height. I hope thats worded a little more clearly, sorry for the confusion. I tried it in Excel on a merged area and it, indeed, seems not to work.

Loader.
Live Chat Icon For mobile
Up arrow icon