NativeExcel for .Net Developer's Reference

IRange.WrapText Property

Gets or sets a value that indicates whether the text are wrapped.

[Visual Basic]
PropertyWrapTextAsBoolean
[C#]
boolWrapText{get;set;}
[C++]
__propertyboolget_WrapText();
__propertyvoidset_WrapText(bool);
[JScript]
functiongetWrapText():bool
functionsetWrapText(bool);

Property Value

true if the text are wrapped; otherwise, false. Microsoft Excel will change the row height of the range, if necessary, to accommodate the text in the range.

Example

This example formats cell B2 on sheet one so that the text wraps within the cell.

[C#]
 IRange r = book.Worksheets[1].Range["B2"]; 
 r.WrapText = true;
 r.Value = "This text should wrap in a cell";
[VisualBasic]
 Dim r As IRange = book.Worksheets(1).Range("B2")
 r.WrapText = True
 r.Value = "This text should wrap in a cell"
[C++]
 IRange* r = book->Worksheets->Item[1]->Range->Item[S"B2"]; 
 r->WrapText = true;
 r->Value = S"This text should wrap in a cell";

See Also

IRange Interface | NativeExcel Namespace