2013-09-01 8 views

答えて

15

あなたはPHPExcelと、このようなあなたのExcelテンプレートを読み込むことができます。

$objPHPExcel = PHPExcel_IOFactory::load("./forms/english/cash.xlsx"); 

、あなたがこのような細胞に書き込むことができます。これらの質問へ

$objPHPExcel->setActiveSheetIndex(0) 
          ->setCellValue('A2', "No") 
          ->setCellValue('B2', "Name") 
          ->setCellValue('C2', "Email") 
          ->setCellValue('D2', "Phone") 
          ->setCellValue('E2', "Address"); 
7

はgithubのサイトで30template.php

https://github.com/PHPOffice/PHPExcel/blob/develop/Examples/30template.php

負荷テンプレート、例を参照してください。

$objReader = PHPExcel_IOFactory::createReader('Excel5'); 

$objPHPExcel = $objReader->load("templates/30template.xls"); 

は一例で見た画像の使用を追加する

$objPHPExcel->getActiveSheet()->setCellValue() 

経由書きますPHPExcel_Worksheet_Drawing:

// Add an image to the worksheet 
$objDrawing = new PHPExcel_Worksheet_Drawing(); 
$objDrawing->setName('My Image'); 
$objDrawing->setDescription('The Image that I am inserting'); 
$objDrawing->setPath('./images/myImage.png'); 
$objDrawing->setCoordinates('B2'); 
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); 
+0

テンプレートの書き方と画像の追加方法 –

+0

画像のサイズ変更:$ objDrawing-> setResizeProportional(true); $ objDrawing-> setWidthAndHeight(230、170); – user2039290

関連する問題