PHP Spreadsheet_Excel_Writer | SetTextWrap () Function

PHP

Syntax:
void Format::setTextWrap()
Parameters:this the function takes no parameters.Return value:this function returns TRUE on success and PEAR_ERROR on error.Example 1: < / strong>
// require_once ' Spreadsheet / Excel / Writer.php & # 39 ;; 
// Add book $workbook = new Spreadsheet_Excel_Writer();  
// Add format to spreadsheet $format_textwrap = & amp; $workbook -> addFormat();  
// Install TextWrap $format_textwrap -> setTextWrap();  
// Add worksheet to Sprerdsheet $worksheet = & amp; $workbook -> addWorksheet();  
// Save to sheet $worksheet -> write (0, 0, "Details of GeeksforGeeks Contributors ", $format_textwrap ); $worksheet -> write (1, 0, "Author" , $format_textwrap ); $worksheet -> write (1, 1, "User Handle" , $format_textwrap ); $worksheet -> write (2, 0, "Sarthak" , $format_textwrap ); $worksheet -> write (2, 1, "sarthak_ishu11" , $format_textwrap );  
// Submit the .xlsx file in the header $workbook -> send ( 'test.xls' );  
// Close the book object $workbook -> close(); ?>
Output: Example 2: < tbody>
// require_once & # 39 ; Spreadsheet / Excel / Writer.php & # 39 ;; 
// Create Spreadsheet_Excel_Writer object $workbook = new Spreadsheet_Excel_Writer();  
// Add worksheet $worksheet = & amp; $workbook -> addWorksheet();  
// Install Family Times New Roman font $format_setTextWrap = & amp; $workbook -> addFormat(); $format_setTextWrap -> setFontFamily ( 'Times New Roman' );  
// Set TextWrap property $format_setTextWrap -> setTextWrap();  
// Set text shadow $format_setTextWrap -> setShadow();  
// Save to sheet $worksheet -> write (0, 0, "Information" ); $worksheet -> write (1, 0, "Website Name" , $format_setTextWrap ); $worksheet -> write (1, 1, "Address" , $format_setTextWrap ); $worksheet -> write (2, 0, "GeeksforGeeks" , $format_setTextWrap ); $worksheet -> write (2, 1, " https://www.engineerforengineer.org/ " , $format_setTextWrap ); $workbook -> send ( 'test.xls' ); $workbook -> close(); ?>
Output: Link : https:// pear .php.net / manual / en / package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.settextwrap.php