40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
|
|
<?php
|
|||
|
|
/**
|
|||
|
|
* Создание минимальных пустых шаблонов Office файлов
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
require_once '/var/www/fastuser/data/www/crm.clientright.ru/vendor/autoload.php';
|
|||
|
|
|
|||
|
|
use PhpOffice\PhpWord\PhpWord;
|
|||
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
|
|
use PhpOffice\PhpPresentation\PhpPresentation;
|
|||
|
|
|
|||
|
|
$templatesDir = __DIR__ . '/templates/';
|
|||
|
|
|
|||
|
|
// Создаём Word документ
|
|||
|
|
$phpWord = new PhpWord();
|
|||
|
|
$section = $phpWord->addSection();
|
|||
|
|
$section->addText('');
|
|||
|
|
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
|
|||
|
|
$objWriter->save($templatesDir . 'empty.docx');
|
|||
|
|
echo "✅ Created empty.docx\n";
|
|||
|
|
|
|||
|
|
// Создаём Excel таблицу
|
|||
|
|
$spreadsheet = new Spreadsheet();
|
|||
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|||
|
|
$sheet->setCellValue('A1', '');
|
|||
|
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
|
|||
|
|
$writer->save($templatesDir . 'empty.xlsx');
|
|||
|
|
echo "✅ Created empty.xlsx\n";
|
|||
|
|
|
|||
|
|
// Создаём PowerPoint презентацию
|
|||
|
|
$presentation = new PhpPresentation();
|
|||
|
|
$slide = $presentation->getActiveSlide();
|
|||
|
|
$writer = \PhpOffice\PhpPresentation\IOFactory::createWriter($presentation, 'PowerPoint2007');
|
|||
|
|
$writer->save($templatesDir . 'empty.pptx');
|
|||
|
|
echo "✅ Created empty.pptx\n";
|
|||
|
|
|
|||
|
|
echo "\n✅ Все шаблоны созданы!\n";
|
|||
|
|
?>
|
|||
|
|
|