Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
XL.Format.SetWrap
Sets the flag whether the cell text is wrapped.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
Book | The reference to the workbook. Please use XL.LoadBook to load a file. | $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"; $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"; $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"; $book; $sheet; $row; 1; "First line" & Char(10) & "Second line"; $textFormat) ]
#
# make line higher
Set Variable [ $r ; Value: MBS( "XL.Sheet.SetRow"; $book; $sheet; $row; 20 ) ]
Create sheet with column format:
# create new xls file
Set Variable [ $book ; Value: MBS( "XL.NewBook"; 1 ) ]
# load logo picture
Set Variable [ $logoID ; Value: MBS( "XL.Book.AddPictureContainer"; $book; Writing data::Logo) ]
# create fonts
# create format for column
Set Variable [ $colFormat ; Value: MBS( "XL.Book.AddFormat"; $book) ]
Set Variable [ $r ; Value: MBS( "XL.Format.SetWrap"; $book; $colFormat; 1) // enable wrap ]
Set Variable [ $r ; Value: MBS( "XL.Format.SetAlignH"; $book; $colFormat; 1) // left ]
#
# create specialized format for one cell with lock
Set Variable [ $lockFormat ; Value: MBS( "XL.Book.AddFormat"; $book; $colFormat) ]
Set Variable [ $r ; Value: MBS( "XL.Format.SetLocked"; $book; $lockFormat; 1) // on ]
#
# create sheet
Set Variable [ $sheet ; Value: MBS( "XL.Book.AddSheet"; $book; "Sales Receipt") ]
# set default format for whole column
Set Variable [ $r ; Value: MBS( "XL.Sheet.SetCol"; $book; $sheet; 1; 1; 12; $colFormat ) ]
#
# put some text in using column format
Set Variable [ $r ; Value: MBS( "XL.Sheet.CellWriteText"; $book; $sheet; 2; 1; "Long text wraps due to column format") ]
#
# and locked format
Set Variable [ $r ; Value: MBS( "XL.Sheet.CellWriteText"; $book; $sheet; 3; 1; "And this is locked"; $lockFormat) ]
#
# save and export
Set Field [ Writing data::Output ; MBS("XL.Book.Save"; $book; "test.xlsx") ]
Set Variable [ $r ; Value: MBS("XL.Book.Release"; $book) ]
#
Export Field Contents [ Writing data::Output ; Create folders: On ]
See also
- XL.Book.AddSheet
- XL.Book.Release
- XL.Format.GetFont
- XL.Format.SetBorder
- XL.Format.SetFont
- XL.Format.SetLocked
- XL.LoadBook
- XL.NewBook
- XL.Sheet.CellWriteText
- XL.Sheet.SetRow
This function checks for a license.
Created 18th August 2014, last changed 11st February 2020