Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00034 class ilExcelWriterAdapter
00035 {
00036 var $workbook = null;
00037
00038 var $format_bold = null;
00039 var $format_header = null;
00040
00041 function ilExcelWriterAdapter($a_filename,$a_send = true)
00042 {
00043 global $ilias, $lng;
00044
00045 $result = @include_once 'Spreadsheet/Excel/Writer.php';
00046 if (!$result)
00047 {
00048 $ilias->raiseError($lng->txt("error_no_excel_support"), $ilias->error_obj->WARNING);
00049 }
00050 if($a_send)
00051 {
00052 $this->workbook =& new Spreadsheet_Excel_Writer();
00053 $this->workbook->send($a_filename);
00054 }
00055 else
00056 {
00057 $this->workbook =& new Spreadsheet_Excel_Writer($a_filename);
00058 }
00059
00060 if(strlen($tmp = ini_get('upload_tmp_dir')))
00061 {
00062 $this->workbook->setTempDir($tmp);
00063 }
00064
00065 $this->__initFormatBold();
00066 $this->__initFormatHeader();
00067 $this->__initFormatTitle();
00068 }
00069
00070 function &getWorkbook()
00071 {
00072 return $this->workbook;
00073 }
00074
00075 function &getFormatBold()
00076 {
00077 return $this->format_bold;
00078 }
00079 function &getFormatHeader()
00080 {
00081 return $this->format_header;
00082 }
00083 function &getFormatTitle()
00084 {
00085 return $this->format_title;
00086 }
00087 function &getFormatDate()
00088 {
00089 return $this->format_date;
00090 }
00091 function &getFormatDayTime()
00092 {
00093 return $this->format_day_time;
00094 }
00095
00096
00097 function __initFormatBold()
00098 {
00099 $this->format_bold =& $this->workbook->addFormat();
00100 $this->format_bold->setBold();
00101 }
00102 function __initFormatHeader()
00103 {
00104 $this->format_header =& $this->workbook->addFormat();
00105 $this->format_header->setBold();
00106 $this->format_header->setTop(100);
00107 $this->format_header->setColor('black');
00108 $this->format_header->setPattern(1);
00109 $this->format_header->setFgColor('silver');
00110 }
00111 function __initFormatTitle()
00112 {
00113 $this->format_title =& $this->workbook->addFormat();
00114 $this->format_title->setBold();
00115 $this->format_title->setColor('black');
00116 $this->format_title->setPattern(1);
00117 $this->format_title->setSize(16);
00118 $this->format_title->setAlign('center');
00119 }
00120 function __initFormatDate()
00121 {
00122 $this->format_date =& $this->workbook->addFormat();
00123 $this->format_date->setNumFormat("YYYY-MM-DD hh:mm:ss");
00124 }
00125
00126 function __initFormatDayTime()
00127 {
00128 $this->format_day_time =& $this->workbook->addFormat();
00129 $this->format_day_time->setNumFormat("DD:hh:mm:ss");
00130 }
00131
00132
00133 }
00134 ?>