Free Support Forum -

Wrap Text on Range

Hi -

I have created a named range and then merged that range. I want to set the IsTextWrap of this merged range to True. However the code I am using is throwing a null exception error. (see my code below) Does the range have to have text in it to set the wrapped text property?

Thank you!

Dim errorRange as Range = worksheet.Cells.CreateRange(21,120,5,20)


errorRange.Style.IsTextWrapped = True


Thanks for considering Aspose.

Kindly utilize the following sample code to wrap the text of a merged range of cells:

Dim workbook As Workbook = New Workbook()

Dim worksheet As Worksheet = workbook.Worksheets(0)

Dim errorRange As Range = worksheet.Cells.CreateRange(21, 120, 5, 20)


Dim style As Style = workbook.Styles(workbook.Styles.Add)

style.IsTextWrapped = True

errorRange.Style = style



Amjad Sahi

Aspose Nanjing Team