📄 worksheet.php
字号:
<?php/** Module written/ported by Xavier Noguer <xnoguer@rezebra.com>** The majority of this is _NOT_ my code. I simply ported it from the* PERL Spreadsheet::WriteExcel module.** The author of the Spreadsheet::WriteExcel module is John McNamara* <jmcnamara@cpan.org>** I _DO_ maintain this code, and John McNamara has nothing to do with the* porting of this code to PHP. Any questions directly related to this* class library should be directed to me.** License Information:** Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets* Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com** This library is free software; you can redistribute it and/or* modify it under the terms of the GNU Lesser General Public* License as published by the Free Software Foundation; either* version 2.1 of the License, or (at your option) any later version.** This library is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU* Lesser General Public License for more details.** You should have received a copy of the GNU Lesser General Public* License along with this library; if not, write to the Free Software* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/require_once(api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer/Parser.php');require_once(api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer/BIFFwriter.php');/*** Class for generating Excel Spreadsheets** @author Xavier Noguer <xnoguer@rezebra.com>* @category FileFormats* @package Spreadsheet_Excel_Writer*/class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwriter{ /** * Name of the Worksheet * @var string */ var $name; /** * Index for the Worksheet * @var integer */ var $index; /** * Reference to the (default) Format object for URLs * @var object Format */ var $_url_format; /** * Reference to the parser used for parsing formulas * @var object Format */ var $_parser; /** * Filehandle to the temporary file for storing data * @var resource */ var $_filehandle; /** * Boolean indicating if we are using a temporary file for storing data * @var bool */ var $_using_tmpfile; /** * Maximum number of rows for an Excel spreadsheet (BIFF5) * @var integer */ var $_xls_rowmax; /** * Maximum number of columns for an Excel spreadsheet (BIFF5) * @var integer */ var $_xls_colmax; /** * Maximum number of characters for a string (LABEL record in BIFF5) * @var integer */ var $_xls_strmax; /** * First row for the DIMENSIONS record * @var integer * @see _storeDimensions() */ var $_dim_rowmin; /** * Last row for the DIMENSIONS record * @var integer * @see _storeDimensions() */ var $_dim_rowmax; /** * First column for the DIMENSIONS record * @var integer * @see _storeDimensions() */ var $_dim_colmin; /** * Last column for the DIMENSIONS record * @var integer * @see _storeDimensions() */ var $_dim_colmax; /** * Array containing format information for columns * @var array */ var $_colinfo; /** * Array containing the selected area for the worksheet * @var array */ var $_selection; /** * Array containing the panes for the worksheet * @var array */ var $_panes; /** * The active pane for the worksheet * @var integer */ var $_active_pane; /** * Bit specifying if panes are frozen * @var integer */ var $_frozen; /** * Bit specifying if the worksheet is selected * @var integer */ var $selected; /** * The paper size (for printing) (DOCUMENT!!!) * @var integer */ var $_paper_size; /** * Bit specifying paper orientation (for printing). 0 => landscape, 1 => portrait * @var integer */ var $_orientation; /** * The page header caption * @var string */ var $_header; /** * The page footer caption * @var string */ var $_footer; /** * The horizontal centering value for the page * @var integer */ var $_hcenter; /** * The vertical centering value for the page * @var integer */ var $_vcenter; /** * The margin for the header * @var float */ var $_margin_head; /** * The margin for the footer * @var float */ var $_margin_foot; /** * The left margin for the worksheet in inches * @var float */ var $_margin_left; /** * The right margin for the worksheet in inches * @var float */ var $_margin_right; /** * The top margin for the worksheet in inches * @var float */ var $_margin_top; /** * The bottom margin for the worksheet in inches * @var float */ var $_margin_bottom; /** * First row to reapeat on each printed page * @var integer */ var $title_rowmin; /** * Last row to reapeat on each printed page * @var integer */ var $title_rowmax; /** * First column to reapeat on each printed page * @var integer */ var $title_colmin; /** * First row of the area to print * @var integer */ var $print_rowmin; /** * Last row to of the area to print * @var integer */ var $print_rowmax; /** * First column of the area to print * @var integer */ var $print_colmin; /** * Last column of the area to print * @var integer */ var $print_colmax; /** * Whether to use outline. * @var integer */ var $_outline_on; /** * Auto outline styles. * @var bool */ var $_outline_style; /** * Whether to have outline summary below. * @var bool */ var $_outline_below; /** * Whether to have outline summary at the right. * @var bool */ var $_outline_right; /** * Outline row level. * @var integer */ var $_outline_row_level; /** * Whether to fit to page when printing or not. * @var bool */ var $_fit_page; /** * Number of pages to fit wide * @var integer */ var $_fit_width; /** * Number of pages to fit high * @var integer */ var $_fit_height; /** * Reference to the total number of strings in the workbook * @var integer */ var $_str_total; /** * Reference to the number of unique strings in the workbook * @var integer */ var $_str_unique; /** * Reference to the array containing all the unique strings in the workbook * @var array */ var $_str_table; /** * Merged cell ranges * @var array */ var $_merged_ranges; /** * Charset encoding currently used when calling writeString() * @var string */ var $_input_encoding; /** * Constructor * * @param string $name The name of the new worksheet * @param integer $index The index of the new worksheet * @param mixed &$activesheet The current activesheet of the workbook we belong to * @param mixed &$firstsheet The first worksheet in the workbook we belong to * @param mixed &$url_format The default format for hyperlinks * @param mixed &$parser The formula parser created for the Workbook * @access private */ function Spreadsheet_Excel_Writer_Worksheet($BIFF_version, $name, $index, &$activesheet, &$firstsheet, &$str_total, &$str_unique, &$str_table, &$url_format, &$parser) { // It needs to call its parent's constructor explicitly $this->Spreadsheet_Excel_Writer_BIFFwriter(); $this->_BIFF_version = $BIFF_version; $rowmax = 65536; // 16384 in Excel 5 $colmax = 256; $this->name = $name; $this->index = $index; $this->activesheet = &$activesheet; $this->firstsheet = &$firstsheet; $this->_str_total = &$str_total; $this->_str_unique = &$str_unique; $this->_str_table = &$str_table; $this->_url_format = &$url_format; $this->_parser = &$parser; //$this->ext_sheets = array(); $this->_filehandle = ''; $this->_using_tmpfile = true; //$this->fileclosed = 0; //$this->offset = 0; $this->_xls_rowmax = $rowmax; $this->_xls_colmax = $colmax; $this->_xls_strmax = 255; $this->_dim_rowmin = $rowmax + 1; $this->_dim_rowmax = 0; $this->_dim_colmin = $colmax + 1; $this->_dim_colmax = 0; $this->_colinfo = array(); $this->_selection = array(0,0,0,0); $this->_panes = array(); $this->_active_pane = 3; $this->_frozen = 0; $this->selected = 0; $this->_paper_size = 0x0; $this->_orientation = 0x1; $this->_header = ''; $this->_footer = ''; $this->_hcenter = 0; $this->_vcenter = 0; $this->_margin_head = 0.50; $this->_margin_foot = 0.50; $this->_margin_left = 0.75; $this->_margin_right = 0.75; $this->_margin_top = 1.00; $this->_margin_bottom = 1.00; $this->title_rowmin = null; $this->title_rowmax = null; $this->title_colmin = null; $this->title_colmax = null; $this->print_rowmin = null; $this->print_rowmax = null; $this->print_colmin = null; $this->print_colmax = null; $this->_print_gridlines = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -