XL.Format.SetWrap
-----------------

Sets the flag whether the cell text is wrapped.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XL](component_XL.md) | [3.5](newinversion35.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XL.Format.SetWrap"; Book; Format; Value ) 

**MBS**( **"XL.Format.SetWrap";** /\* Sets the flag whether the cell text is wrapped. \*/  
**$Book**; /\* The reference number for the workbook.e.g. $ref \*/   
**$Format**; /\* The index of the format in the book to target.e.g. 0 \*/   
**$Value**) /\* The new setting. Pass 1 to enable wrap and 0 to disable. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Book | The reference number for the workbook. | $ref |
| Format | The index of the format in the book to target. | 0 |
| Value | The new setting. Pass 1 to enable wrap and 0 to disable. | $value |

### Result

Returns OK or error.

### Description

Sets the flag whether the cell text is wrapped.  
### Examples

Create wrapping format:

 Set Variable \[$textFormat ; Value:MBS ( "[XL.Book.AddFormat](XLBookAddFormat.md)"; $book )\]  
Set Variable \[$r ; Value:MBS ( "XL.Format.SetWrap"; $book ; $textFormat ; 1)\]  
Write two lines with adjusting the row height:

 # create format with wrap   
\#   
Set Variable \[ $textFormat ; Value: MBS ( "[XL.Book.AddFormat](XLBookAddFormat.md)"; $book ) \]   
Set Variable \[ $r ; Value: MBS ( "XL.Format.SetWrap"; $book ; $textFormat ; 1) \]   
\#   
\# put in text with Char(10) for new line   
\#   
Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.CellWriteText](XLSheetCellWriteText.md)"; $book ; $sheet ; $row ; 1; "First line" &amp; Char(10) &amp; "Second line"; $textFormat ) \]   
\#   
\# make line higher   
Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.SetRow](XLSheetSetRow.md)"; $book ; $sheet ; $row ; 20 ) \]  
Create sheet with column format:

 # create new xls file   
Set Variable \[ $book ; Value: MBS ( "[XL.NewBook](XLNewBook.md)"; 1 ) \]   
\# load logo picture   
Set Variable \[ $logoID ; Value: MBS ( "[XL.Book.AddPictureContainer](XLBookAddPictureContainer.md)"; $book ; Writing data::Logo ) \]   
\# create fonts   
\# create format for column   
Set Variable \[ $colFormat ; Value: MBS ( "[XL.Book.AddFormat](XLBookAddFormat.md)"; $book ) \]   
Set Variable \[ $r ; Value: MBS ( "XL.Format.SetWrap"; $book ; $colFormat ; 1) // enable wrap \]   
Set Variable \[ $r ; Value: MBS ( "[XL.Format.SetAlignH](XLFormatSetAlignH.md)"; $book ; $colFormat ; 1) // left \]   
\#   
\# create specialized format for one cell with lock   
Set Variable \[ $lockFormat ; Value: MBS ( "[XL.Book.AddFormat](XLBookAddFormat.md)"; $book ; $colFormat ) \]   
Set Variable \[ $r ; Value: MBS ( "[XL.Format.SetLocked](XLFormatSetLocked.md)"; $book ; $lockFormat ; 1) // on \]   
\#   
\# create sheet   
Set Variable \[ $sheet ; Value: MBS ( "[XL.Book.AddSheet](XLBookAddSheet.md)"; $book ; "Sales Receipt") \]   
\# set default format for whole column   
Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.SetCol](XLSheetSetCol.md)"; $book ; $sheet ; 1; 1; 12; $colFormat ) \]   
\#   
\# put some text in using column format   
Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.CellWriteText](XLSheetCellWriteText.md)"; $book ; $sheet ; 2; 1; "Long text wraps due to column format") \]   
\#   
\# and locked format   
Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.CellWriteText](XLSheetCellWriteText.md)"; $book ; $sheet ; 3; 1; "And this is locked"; $lockFormat ) \]   
\#   
\# save and export   
Set Field \[ Writing data::Output ; MBS ("[XL.Book.Save](XLBookSave.md)"; $book ; "test.xlsx") \]   
Set Variable \[ $r ; Value: MBS ("[XL.Book.Release](XLBookRelease.md)"; $book ) \]   
\#   
Export Field Contents \[ Writing data::Output ; Create folders: On \]  
### See also

- [XL.Book.AddPictureContainer](XLBookAddPictureContainer.md)
- [XL.Book.AddSheet](XLBookAddSheet.md)
- [XL.Format.GetFont](XLFormatGetFont.md)
- [XL.Format.SetAlignH](XLFormatSetAlignH.md)
- [XL.Format.SetBorder](XLFormatSetBorder.md)
- [XL.Format.SetFont](XLFormatSetFont.md)
- [XL.Format.SetLocked](XLFormatSetLocked.md)
- [XL.NewBook](XLNewBook.md)
- [XL.Sheet.CellWriteText](XLSheetCellWriteText.md)
- [XL.Sheet.SetRow](XLSheetSetRow.md)

This function checks for a license.

Created 18th August 2014 , last changed 11st February 2020

  
[XL.Format.SetShrinkToFit](XLFormatSetShrinkToFit.md) - [XL.Initialize](XLInitialize.md)

[HTML Version](XLFormatSetWrap.shtml)