你好我正在尝试使用 phpexcel 创建一个 excel 模板
由于某种原因,图像会创建新的工作表而不是使用当前的工作表。所以当我打开我创建的 excel 文件时,有 worksheet和worksheet1而不是单个。
objPHPExcel = new PHPExcel();
$objWorkSheet = $objPHPExcel->createSheet();
// Set the active Excel worksheet to sheet 0
$objPHPExcel->setActiveSheetIndex(0);
//Taslak Verileri
$objPHPExcel->getActiveSheet()->SetCellValue('D'.'1', 'Firm');
$objPHPExcel->getActiveSheet()->SetCellValue('J'.'1', 'SFUFORMU - FR.PS.21');
$objPHPExcel->getActiveSheet()->SetCellValue('J'.'3', 'NO:');
$objPHPExcel->getActiveSheet()->SetCellValue('D'.'2', 'Name Surname Signature');
$objPHPExcel->getActiveSheet()->SetCellValue('A'.'4', 'Date');
$objPHPExcel->getActiveSheet()->SetCellValue('A'.'5', 'Stock No:');
$objPHPExcel->getActiveSheet()->SetCellValue('C'.'5', 'Image');
$objPHPExcel->getActiveSheet()->SetCellValue('E'.'5', 'Image');
$objPHPExcel->getActiveSheet()->SetCellValue('G'.'5', 'Resim');
$objPHPExcel->getActiveSheet()->SetCellValue('I'.'5', 'Image');
$objPHPExcel->getActiveSheet()->SetCellValue('K'.'5', 'Quantity');
$objPHPExcel->getActiveSheet()->SetCellValue('M'.'5', 'Price');
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setWorksheet($objWorkSheet);
$objDrawing->setName("name");
$objDrawing->setDescription("Description");
$objDrawing->setPath('temp/3.jpeg');
$objDrawing->setCoordinates('F9');
$objDrawing->setOffsetX(1);
$objDrawing->setOffsetY(5);
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save('some_excel_file.xlsx');