⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 format.php

📁 完美的在线教育系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
                        'yellow'  => 0x0D                       );        // Return the default color, 0x7FFF, if undef,        if ($name_color == '') {            return(0x7FFF);        }        // or the color string converted to an integer,        if (isset($colors[$name_color])) {            return($colors[$name_color]);        }        // or the default color if string is unrecognised,        if (preg_match("/\D/",$name_color)) {            return(0x7FFF);        }        // or an index < 8 mapped into the correct range,        if ($name_color < 8) {            return($name_color + 8);        }        // or the default color if arg is outside range,        if ($name_color > 63) {            return(0x7FFF);        }        // or an integer in the valid range        return($name_color);    }    /**    * Set cell alignment.    *    * @access public    * @param string $location alignment for the cell ('left', 'right', etc...).    */    function setAlign($location)    {        if (preg_match("/\d/",$location)) {            return;                      // Ignore numbers        }        $location = strtolower($location);        if ($location == 'left') {            $this->_text_h_align = 1;        }        if ($location == 'centre') {            $this->_text_h_align = 2;        }        if ($location == 'center') {            $this->_text_h_align = 2;        }        if ($location == 'right') {            $this->_text_h_align = 3;        }        if ($location == 'fill') {            $this->_text_h_align = 4;        }        if ($location == 'justify') {            $this->_text_h_align = 5;        }        if ($location == 'merge') {            $this->_text_h_align = 6;        }        if ($location == 'equal_space') { // For T.K.            $this->_text_h_align = 7;        }        if ($location == 'top') {            $this->_text_v_align = 0;        }        if ($location == 'vcentre') {            $this->_text_v_align = 1;        }        if ($location == 'vcenter') {            $this->_text_v_align = 1;        }        if ($location == 'bottom') {            $this->_text_v_align = 2;        }        if ($location == 'vjustify') {            $this->_text_v_align = 3;        }        if ($location == 'vequal_space') { // For T.K.            $this->_text_v_align = 4;        }    }    /**    * Set cell horizontal alignment.    *    * @access public    * @param string $location alignment for the cell ('left', 'right', etc...).    */    function setHAlign($location)    {        if (preg_match("/\d/",$location)) {            return;                      // Ignore numbers        }            $location = strtolower($location);            if ($location == 'left') {            $this->_text_h_align = 1;        }        if ($location == 'centre') {            $this->_text_h_align = 2;        }        if ($location == 'center') {            $this->_text_h_align = 2;        }        if ($location == 'right') {            $this->_text_h_align = 3;        }        if ($location == 'fill') {            $this->_text_h_align = 4;        }        if ($location == 'justify') {            $this->_text_h_align = 5;        }        if ($location == 'merge') {            $this->_text_h_align = 6;        }        if ($location == 'equal_space') { // For T.K.            $this->_text_h_align = 7;        }    }    /**    * Set cell vertical alignment.    *    * @access public    * @param string $location alignment for the cell ('top', 'vleft', 'vright', etc...).    */    function setVAlign($location)    {        if (preg_match("/\d/",$location)) {            return;                      // Ignore numbers        }            $location = strtolower($location);         if ($location == 'top') {            $this->_text_v_align = 0;        }        if ($location == 'vcentre') {            $this->_text_v_align = 1;        }        if ($location == 'vcenter') {            $this->_text_v_align = 1;        }        if ($location == 'bottom') {            $this->_text_v_align = 2;        }        if ($location == 'vjustify') {            $this->_text_v_align = 3;        }        if ($location == 'vequal_space') { // For T.K.            $this->_text_v_align = 4;        }    }    /**    * This is an alias for the unintuitive setAlign('merge')    *    * @access public    */    function setMerge()    {        $this->setAlign('merge');    }    /**    * Sets the boldness of the text.    * Bold has a range 100..1000.    * 0 (400) is normal. 1 (700) is bold.    *    * @access public    * @param integer $weight Weight for the text, 0 maps to 400 (normal text),                             1 maps to 700 (bold text). Valid range is: 100-1000.                             It's Optional, default is 1 (bold).    */    function setBold($weight = 1)    {        if ($weight == 1) {            $weight = 0x2BC;  // Bold text        }        if ($weight == 0) {            $weight = 0x190;  // Normal text        }        if ($weight <  0x064) {            $weight = 0x190;  // Lower bound        }        if ($weight >  0x3E8) {            $weight = 0x190;  // Upper bound        }        $this->_bold = $weight;    }    /************************************    * FUNCTIONS FOR SETTING CELLS BORDERS    */    /**    * Sets the width for the bottom border of the cell    *    * @access public    * @param integer $style style of the cell border. 1 => thin, 2 => thick.    */    function setBottom($style)    {        $this->_bottom = $style;    }    /**    * Sets the width for the top border of the cell    *    * @access public    * @param integer $style style of the cell top border. 1 => thin, 2 => thick.    */    function setTop($style)    {        $this->_top = $style;    }    /**    * Sets the width for the left border of the cell    *    * @access public    * @param integer $style style of the cell left border. 1 => thin, 2 => thick.    */    function setLeft($style)    {        $this->_left = $style;    }    /**    * Sets the width for the right border of the cell    *    * @access public    * @param integer $style style of the cell right border. 1 => thin, 2 => thick.    */    function setRight($style)    {        $this->_right = $style;    }    /**    * Set cells borders to the same style    *    * @access public    * @param integer $style style to apply for all cell borders. 1 => thin, 2 => thick.    */    function setBorder($style)    {        $this->setBottom($style);        $this->setTop($style);        $this->setLeft($style);        $this->setRight($style);    }    /*******************************************    * FUNCTIONS FOR SETTING CELLS BORDERS COLORS    */    /**    * Sets all the cell's borders to the same color    *    * @access public    * @param mixed $color The color we are setting. Either a string (like 'blue'),    *                     or an integer (range is [8...63]).    */    function setBorderColor($color)    {        $this->setBottomColor($color);        $this->setTopColor($color);        $this->setLeftColor($color);        $this->setRightColor($color);    }    /**    * Sets the cell's bottom border color    *    * @access public    * @param mixed $color either a string (like 'blue'), or an integer (range is [8...63]).    */    function setBottomColor($color)    {        $value = $this->_getColor($color);        $this->_bottom_color = $value;    }    /**    * Sets the cell's top border color    *    * @access public    * @param mixed $color either a string (like 'blue'), or an integer (range is [8...63]).    */    function setTopColor($color)    {        $value = $this->_getColor($color);        $this->_top_color = $value;    }    /**    * Sets the cell's left border color    *    * @access public    * @param mixed $color either a string (like 'blue'), or an integer (range is [8...63]).    */    function setLeftColor($color)    {        $value = $this->_getColor($color);        $this->_left_color = $value;    }    /**    * Sets the cell's right border color    *    * @access public    * @param mixed $color either a string (like 'blue'), or an integer (range is [8...63]).    */    function setRightColor($color)    {        $value = $this->_getColor($color);        $this->_right_color = $value;    }    /**    * Sets the cell's foreground color    *    * @access public    * @param mixed $color either a string (like 'blue'), or an integer (range is [8...63]).    */    function setFgColor($color)    {        $value = $this->_getColor($color);        $this->_fg_color = $value;        if ($this->_pattern == 0) { // force color to be seen            $this->_pattern = 1;        }    }    /**    * Sets the cell's background color    *    * @access public    * @param mixed $color either a string (like 'blue'), or an integer (range is [8...63]).    */    function setBgColor($color)    {        $value = $this->_getColor($color);        $this->_bg_color = $value;        if ($this->_pattern == 0) { // force color to be seen            $this->_pattern = 1;        }    }    /**    * Sets the cell's color    *    * @access public    * @param mixed $color either a string (like 'blue'), or an integer (range is [8...63]).    */    function setColor($color)    {        $value = $this->_getColor($color);        $this->_color = $value;    }    /**    * Sets the fill pattern attribute of a cell    *    * @access public    * @param integer $arg Optional. Defaults to 1. Meaningful values are: 0-18,    *                     0 meaning no background.    */    function setPattern($arg = 1)    {        $this->_pattern = $arg;    }    /**    * Sets the underline of the text    *    * @access public    * @param integer $underline The value for underline. Possible values are:    *                          1 => underline, 2 => double underline.    */    function setUnderline($underline)    {        $this->_underline = $underline;    }    /**    * Sets the font style as italic    *    * @access public    */    function setItalic()    {        $this->_italic = 1;    }    /**    * Sets the font size    *    * @access public    * @param integer $size The font size (in pixels I think).    */    function setSize($size)    {        $this->_size = $size;    }    /**    * Sets text wrapping    *    * @access public    */    function setTextWrap()    {        $this->_text_wrap = 1;    }    /**    * Sets the orientation of the text    *    * @access public    * @param integer $angle The rotation angle for the text (clockwise). Possible                            values are: 0, 90, 270 and -1 for stacking top-to-bottom.    */    function setTextRotation($angle)    {        switch ($angle)        {            case 0:                $this->_rotation = 0;                break;            case 90:                $this->_rotation = 3;                break;            case 270:                $this->_rotation = 2;                break;            case -1:                $this->_rotation = 1;                break;            default :                return $this->raiseError("Invalid value for angle.".                                  " Possible values are: 0, 90, 270 and -1 ".                                  "for stacking top-to-bottom.");                $this->_rotation = 0;                break;        }    }    /**    * Sets the numeric format.    * It can be date, time, currency, etc...    *    * @access public    * @param integer $num_format The numeric format.    */    function setNumFormat($num_format)    {        $this->_num_format = $num_format;    }    /**    * Sets font as strikeout.    *    * @access public    */    function setStrikeOut()    {        $this->_font_strikeout = 1;    }    /**    * Sets outlining for a font.    *    * @access public    */    function setOutLine()    {        $this->_font_outline = 1;    }    /**    * Sets font as shadow.    *    * @access public    */    function setShadow()    {        $this->_font_shadow = 1;    }    /**    * Sets the script type of the text    *    * @access public    * @param integer $script The value for script type. Possible values are:    *                        1 => superscript, 2 => subscript.    */    function setScript($script)    {        $this->_font_script = $script;    }     /**     * Locks a cell.     *     * @access public     */     function setLocked()     {         $this->_locked = 1;     }    /**    * Unlocks a cell. Useful for unprotecting particular cells of a protected sheet.    *    * @access public    */    function setUnLocked()    {        $this->_locked = 0;    }    /**    * Sets the font family name.    *    * @access public    * @param string $fontfamily The font family name. Possible values are:    *                           'Times New Roman', 'Arial', 'Courier'.    */    function setFontFamily($font_family)    {        $this->_font_name = $font_family;    }}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -