PHP | Spreadsheet_Excel_Writer | setScript() Function Last Updated : 21 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The setScript() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the script type of the text. Syntax: void Format::setScript( $script ) Parameters: This function accepts single parameter $script which contains two value as 1 for superscript and 2 for subscript. Return Value: This function returns TRUE on success and PEAR_ERROR on failure. Example 1: php <?php require_once 'Spreadsheet/Excel/Writer.php'; // Create Spreadsheet_Excel_Writer object $workbook = new Spreadsheet_Excel_Writer(); $worksheet =& $workbook->addWorksheet(); // Creating the formats $format_superscript =& $workbook->addFormat(); $format_superscript->setScript(1); // Add Worksheet $worksheet =& $workbook->addWorksheet(); // Add superscript Text to cell $worksheet->write(0, 0, "x2", $format_superscript); $workbook->send('test.xls'); $workbook->close(); ?> Output: Example 2: php <?php require_once 'Spreadsheet/Excel/Writer.php'; // Create Spreadsheet_Excel_Writer object $workbook = new Spreadsheet_Excel_Writer(); $worksheet =& $workbook->addWorksheet(); // Creating the formats $format_superscript =& $workbook->addFormat(); $format_subscript->setScript(2); // Add Worksheet $worksheet =& $workbook->addWorksheet(); // Add subscript text to cell $worksheet->write(0, 0, "Mg2SO4", $format_subscript); $workbook->send('test.xls'); $workbook->close(); ?> Output: Reference: https://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setscript.php Comment More infoAdvertise with us Next Article PHP | Spreadsheet_Excel_Writer | setScript() Function sarthak_ishu11 Follow Improve Article Tags : Technical Scripter Web Technologies PHP PHP-function PHP-Spreadsheet +1 More Similar Reads PHP | Spreadsheet_Excel_Writer | setStrikeOut() Function The setStrikeOut() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set font as a strikeout. Syntax:Â void Format::setStrikeOut() Parameters: This function does not accept any parameter. Return Value: This function returns TRUE on success and PEAR_ERROR on failure. 1 min read PHP | Spreadsheet_Excel_Writer | setColor() Function The setColor() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the color of a cell content. Syntax: void Format::setColor( mixed $color ) Parameters: This function accepts single parameter as $color which takes value of color as string like 'green' or value fro 2 min read PHP | Spreadsheet_Excel_Writer | setItalic() Function The setItalic() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the font style as italic. Syntax:Â void Format::setItalic() Parameters: This function does not accept any parameter. Return Value: This function returns TRUE on success and PEAR_ERROR on failure. E 1 min read PHP | Spreadsheet_Excel_Writer | setBgColor() Function The setBgColor() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the background color of the cell of the spreadsheet. In order to use this function use the setPattern function. Syntax: void Format::setBgColor( $color ) Parameters: This function accepts single p 2 min read PHP | Spreadsheet_Excel_Writer | setFgColor() Function The setFgColor() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the foreground color for the cell of the spreadsheet. In order to use this function use the setPattern function. Here, "foreground" means the top layer of a cell's background. Syntax: void Format: 2 min read PHP | Spreadsheet_Excel_Writer | send() Function The send() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to send HTTP headers with the correct content-type (application/vnd.ms-excel), cache control and filename for the file. Syntax: void Spreadsheet_Excel_Writer::send( $filename ) Parameters: This function accept 2 min read PHP | Spreadsheet_Excel_Writer | setTextWrap() Function The setTextWrap() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set text wrapping for text in a spreadsheet. Syntax:Â void Format::setTextWrap() Parameters: This function does not accept any parameter. Return Value: This function returns TRUE on success and PEAR_ 1 min read PHP | Spreadsheet_Excel_Writer | setAlign() Function The setAlign() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set cell alignment of the spreadsheet. Syntax: void Format::setAlign( $location ) Parameters: This function accepts single parameter $location which takes the position, as Horizontal Alignments (left, c 2 min read PHP | Spreadsheet_Excel_Writer | setVAlign() Function The setVAlign() function is an inbuilt function in Spreadsheet_Excel_Writer which is used to set cell alignment of the spreadsheet. This is an alternative to the setAlign() function. Syntax:Â void Format::setVAlign( $location ) Parameters: This function accepts single parameter $location which is us 2 min read PHP | Spreadsheet_Excel_Writer | setShadow() Function The setShadow() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the font as a shadow. Syntax:Â void Format::setShadow() Parameters: This function does not accept any parameter. Return Value: This function returns TRUE on success and PEAR_ERROR on failure. Examp 2 min read Like