Esempio n. 1
0
 /**
  * Checks that the given argument is valid
  * To be used as callback in GetOpt argument validation
  * @param string $arg Command-line option argument to validate
  * @return bool true if valid
  */
 static function validate($arg)
 {
     switch (strtolower($arg[0])) {
         case 'a':
         case 't':
         case '2':
             self::$format = self::ALL;
             return true;
         case 'x':
             self::$format = self::EXCEL;
             return true;
         case 'p':
             self::$format = self::PDF;
             return true;
         default:
             return false;
     }
 }
Esempio n. 2
0
 $xlWS->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4)->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)->setFitToWidth(1)->setFitToHeight(0);
 $xlWS->getPageMargins()->setLeft(0.5)->setRight(0.5);
 // Page footer
 $xlWS->getHeaderFooter()->setOddFooter('&L&F' . '&C' . 'APECOVE - http://apecove.ch' . '&R' . date('d.m.Y H:i:s'));
 // ----------------------------------------------------------------------------
 // Save the workbook
 //
 $xlWS->setSelectedCells('A1');
 // List of generated files
 $files = array();
 if (ExportFileFormat::isExcel()) {
     $files[] = $filename = $base_filename . '.xlsx';
     PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
     save($xl, $filename, 'PHPExcel_Writer_Excel2007');
 }
 if (ExportFileFormat::isPDF()) {
     $files[] = $filename = $base_filename . '.pdf';
     // PDF output relies on ShowGridlines and not PrintGridlines
     $xlWS->setShowGridlines(false);
     // With 'exact' autosize method, columns are too narrow, causing cell
     // contents (e.g. phone numbers) to wrap
     PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX);
     save($xl, $filename, 'PHPExcel_Writer_PDF');
 }
 // ------------------------------------------------------------------------
 // Send e-mail
 //
 if ($opt['send'] || $opt['debug']) {
     if ($send_email) {
         $recipients = array('to' => array_unique($recipients), 'bcc' => array_column($profs, 'email'));
         echo '  ';