[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 3 require_once "class.writeexcel_workbook.inc.php"; 4 require_once "class.writeexcel_worksheet.inc.php"; 5 6 $fname = tempnam("/tmp", "merge2.xls"); 7 $workbook = &new writeexcel_workbook($fname); 8 $worksheet = &$workbook->addworksheet(); 9 10 # Set the column width for columns 1, 2 and 3 11 $worksheet->set_column(1, 1, 24); 12 $worksheet->set_column(2, 2, 34); 13 $worksheet->set_column(3, 3, 34); 14 15 # Set the row height for rows 1, 4, and 6. The heigt of row 2 will adjust 16 # automatically to fit the text. 17 # 18 $worksheet->set_row(0, 30); 19 $worksheet->set_row(3, 40); 20 $worksheet->set_row(5, 80); 21 22 # No newlines 23 $str1 = "For whatever we lose (like a you or a me) "; 24 $str1 .= "it's always ourselves we find in the sea"; 25 26 # Embedded newlines 27 $str2 = "For whatever we lose\n(like a you or a me)\n"; 28 $str2 .= "it's always ourselves\nwe find in the sea"; 29 30 31 # Create a format for the column headings 32 $header =& $workbook->addformat(); 33 $header->set_bold(); 34 $header->set_font("Courier New"); 35 $header->set_align('center'); 36 $header->set_align('vcenter'); 37 38 # Create a "vertical justification" format 39 $format1 =& $workbook->addformat(); 40 $format1->set_align('vjustify'); 41 42 # Create a "text wrap" format 43 $format2 =& $workbook->addformat(); 44 $format2->set_text_wrap(); 45 46 # Write the headers 47 $worksheet->write(0, 1, "set_align('vjustify')", $header); 48 $worksheet->write(0, 2, "set_align('vjustify')", $header); 49 $worksheet->write(0, 3, "set_text_wrap()", $header); 50 51 # Write some examples 52 $worksheet->write(1, 1, $str1, $format1); 53 $worksheet->write(1, 2, $str1, $format1); 54 $worksheet->write(1, 3, $str2, $format2); 55 56 $worksheet->write(3, 1, $str1, $format1); 57 $worksheet->write(3, 2, $str1, $format1); 58 $worksheet->write(3, 3, $str2, $format2); 59 60 $worksheet->write(5, 1, $str1, $format1); 61 $worksheet->write(5, 2, $str1, $format1); 62 $worksheet->write(5, 3, $str2, $format2); 63 64 $workbook->close(); 65 66 header("Content-Type: application/x-msexcel"); 67 $fh=fopen($fname, "rb"); 68 fpassthru($fh); 69 unlink($fname); 70 71 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |