|
|
|
สอบถามเรื่องการใช้ merge cell excel ในแนวตั้ง ....................... |
|
|
|
|
|
|
|
ใช้ Library ตัวไหนครับ
|
|
|
|
|
Date :
2013-10-17 10:58:45 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
require_once "class.writeexcel_workbook.inc.php";
require_once "class.writeexcel_worksheet.inc.php";
ใช้พวกนี้อ่ะครับ ตอบตรงคำถามหรือป่าวเนี้ย
|
|
|
|
|
Date :
2013-10-17 13:59:38 |
By :
kwave |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$objPHPExcel->setActiveSheetIndex(0)->mergeCells('A1:C1');
ระบุ Cell เอาครับ
|
|
|
|
|
Date :
2013-10-17 17:11:34 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่ได้ครับ
อันนี้ที่ผมทำแนวนอนแต่แนวตั้งดัดแปลงแล้วไม่ได้เลย รบกวนด้วยนะครับ
Code (PHP)
<?php
set_time_limit(10);
require_once "class.writeexcel_workbook.inc.php";
require_once "class.writeexcel_worksheet.inc.php";
$fname = tempnam("/tmp", "merge2.xls");
$workbook = &new writeexcel_workbook($fname);
$worksheet = &$workbook->addworksheet();
# Set the column width for columns 2 and 3
$worksheet->set_column(1, 2, 20);
# Set the row height for row 2
$worksheet->set_row(2, 30);
# Create a border format
$border1 =& $workbook->addformat();
$border1->set_color('white');
$border1->set_bold();
$border1->set_size(15);
$border1->set_pattern(0x1);
$border1->set_fg_color('green');
$border1->set_border_color('yellow');
$border1->set_top(6);
$border1->set_bottom(6);
$border1->set_left(6);
$border1->set_align('center');
$border1->set_align('vcenter');
$border1->set_merge(); # This is the key feature
# Create another border format. Note you could use copy() here.
$border2 =& $workbook->addformat();
$border2->set_color('white');
$border2->set_bold();
$border2->set_size(15);
$border2->set_pattern(0x1);
$border2->set_fg_color('green');
$border2->set_border_color('yellow');
$border2->set_top(6);
$border2->set_bottom(6);
$border2->set_right(6);
$border2->set_align('center');
$border2->set_align('vcenter');
$border2->set_merge(); # This is the key feature
# Only one cell should contain text, the others should be blank.
$worksheet->write (2, 1, "Merged Cells", $border1);
$worksheet->write_blank(2, 2, $border2);
$workbook->close();
header("Content-Type: application/x-msexcel; name=\"example-merge2.xls\"");
header("Content-Disposition: inline; filename=\"example-merge2.xls\"");
$fh=fopen($fname, "rb");
fpassthru($fh);
unlink($fname);
?>
|
|
|
|
|
Date :
2013-10-18 11:39:02 |
By :
kwave |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|