mk-j / PHP_XLSXWriter

Lightweight XLSX Excel Spreadsheet Writer in PHP
MIT License
1.84k stars 665 forks source link

Show hide grid line code modifications #238

Closed paragajency closed 1 year ago

paragajency commented 5 years ago

/* custom code to hide or show grid line  */ 
    protected $showGridLines;/*custom code to hide or show grid line  */

        public function __construct()
    {
        if(!ini_get('date.timezone'))
        {
            //using date functions can kick out warning if this isn't set
            date_default_timezone_set('UTC');
        }
        $this->addCellStyle($number_format='GENERAL', $style_string=null);
        $this->addCellStyle($number_format='GENERAL', $style_string=null);
        $this->addCellStyle($number_format='GENERAL', $style_string=null);
        $this->addCellStyle($number_format='GENERAL', $style_string=null);      
        $this->setShowGridLines('true');/*custom code to hide or show grid line  */
    } 

       /*Added by on 29042019 custom code to hide or show grid line  */  
    public function setShowGridLines($show=true) { $this->showGridLines=$show; }     
    public function getShowGridLines() { return $this->showGridLines; } 
    /*Added by on 29042019 custom code to hide or show grid line  */
protected function initializeSheet($sheet_name, $col_widths=array(), $auto_filter=false, $freeze_rows=false, $freeze_columns=false ){
.
.
.
.

$sheet->file_writer->write(    '<sheetView colorId="64" defaultGridColor="true" rightToLeft="false" showFormulas="false" showGridLines="'.$this->getShowGridLines().'" showOutlineSymbols="true" showRowColHeaders="true" showZeros="true" tabSelected="' . $tabselected . '" topLeftCell="A1" view="normal" windowProtection="false" workbookViewId="0" zoomScale="100" zoomScaleNormal="100" zoomScalePageLayoutView="100">');
.
.
.
.
 }

Usage : $writer = new XLSXWriter(); $writer->setShowGridLines('false');