无法更改 PHPPowerpoint 幻灯片的宽度和高度

Unable to change PHPPowerpoint Slide Width and Height

您好,我正在使用 PHPpowerpoint 库通过 PHP 生成 Powerpoint 演示文稿,我已成功生成 但我的问题是生成的 PPT 的页面设置是 Width:10 英寸和高度 7.5 英寸。我需要更改页面的宽度和高度。 我在哪里更改库中的宽度和高度。 提前致谢

<?php
 function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint){
 // Create slide
 $slide = $objPHPPowerPoint->createSlide();
 // Add background image
 $slide->createDrawingShape()
 ->setName('Background')
 ->setDescription('Background')
 ->setPath('./resources/bg.gif')
 ->setWidth(350)
 ->setHeight(700)
 ->setOffsetX(0)
 ->setOffsetY(0);
 return $slide;
 }


 set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
 include 'PHPPowerPoint.php';
 if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
 define('EOL', PHP_EOL);
 }
 else {
 define('EOL', '<br />');
 }
 $basename="File";
 $objPHPPowerPoint = new PHPPowerPoint();
 $objPHPPowerPoint->getProperties()->setCreator('Monthly Performanace Summary')
                              ->setLastModifiedBy($gLogUserName)
                              ->setTitle('Monthly Performanace Summary')
                              ->setSubject('Monthly Performanace Summary')
                              ->setDescription('Monthly Performanace Summary.')
                              ->setKeywords('Monthly Performanace Summary')
                              ->setCategory('Monthly Performanace Summary');

 $objPHPPowerPoint->removeSlideByIndex(0);
//VF 1 st Slide
$currentSlide = createTemplatedSlide($objPHPPowerPoint); 
 //Slide Content
 $shape = $currentSlide->createDrawingShape();
 $shape->setName('Part page');
 $shape->setDescription('Page');
 $shape->setPath('Sample.jpg'); 
 $shape->setHeight(1300);
 $shape  ->setWidth(1300);
 $shape->getShadow()->setVisible(true);
 $shape->getShadow()->setDirection(15);
 $shape->getShadow()->setDistance(10);
 $formats = array('PowerPoint2007' => 'pptx');
 foreach ($formats as $format => $extension) {
 $objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, $format);
 $FileName="PPT/{$basename}.{$extension}";
 $objWriter->save("PPT/{$basename}.{$extension}");
 }
 ?>

我添加了我的代码并从 https://php-download.com/package/phpoffice/phppowerpoint

下载了库

我终于在这个文件中找到了解决方案 "Classes\PHPPowerPoint\Writer\PowerPoint2007\Presentation.php"

$objWriter->startElement('p:sldSz');
//$objWriter->writeAttribute('cx', '9144000');
//$objWriter->writeAttribute('cy', '6858000');
$objWriter->writeAttribute('cx', $pPHPPowerPoint->getLayout()->getCX());
$objWriter->writeAttribute('cy', $pPHPPowerPoint->getLayout()->getCY());

将上一行更改为

$objWriter->startElement('p:sldSz');
$objWriter->writeAttribute('cx', '12190000'); 
$objWriter->writeAttribute('cy', '6858000');
// $objWriter->writeAttribute('cx', $pPHPPowerPoint->getLayout()->getCX());
//$objWriter->writeAttribute('cy', $pPHPPowerPoint->getLayout()->getCY());