本文整理匯總了PHP中PhpOffice\PhpWord\Settings::loadConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings::loadConfig方法的具體用法?PHP Settings::loadConfig怎麽用?PHP Settings::loadConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PhpOffice\PhpWord\Settings
的用法示例。
在下文中一共展示了Settings::loadConfig方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: PhpWord
function __construct($testResultsHandler)
{
Autoloader::register();
Settings::loadConfig();
$this->testResultsHandler = $testResultsHandler;
$this->phpWord = new PhpWord();
}
示例2: __construct
/**
* Create new instance
*
* Collections are created dynamically
*/
public function __construct()
{
// Collection
Settings::loadConfig();
$collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts');
foreach ($collections as $collection) {
$class = 'PhpOffice\\PhpWord\\Collection\\' . $collection;
$this->collections[$collection] = new $class();
}
// Metadata
$metadata = array('DocInfo', 'Protection', 'Compatibility');
foreach ($metadata as $meta) {
$class = 'PhpOffice\\PhpWord\\Metadata\\' . $meta;
$this->metadata[$meta] = new $class();
}
}
示例3: array
function __construct()
{
parent::__construct();
Autoloader::register();
Settings::loadConfig();
Settings::setTempDir(getcwd() . TMPDIR_WORD);
// Set writers
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf');
// Set PDF renderer
if (Settings::getPdfRendererPath() === null) {
$writers['PDF'] = null;
}
// Return to the caller script when runs by CLI
if (PHP_SAPI == 'cli') {
return;
}
}
示例4: elseif
@(include_once "Image/Barcode2.php");
require_once $serverRoot . '/classes/PhpWord/Autoloader.php';
header("Content-Type: text/html; charset=" . $charset);
ini_set('max_execution_time', 180);
//180 seconds = 3 minutes
$ses_id = session_id();
if (class_exists('Image_Barcode2')) {
$bcObj = new Image_Barcode2();
} elseif (class_exists('Image_Barcode')) {
$bcObj = new Image_Barcode();
}
$labelManager = new OccurrenceLabel();
use PhpOffice\PhpWord\Autoloader;
use PhpOffice\PhpWord\Settings;
Autoloader::register();
Settings::loadConfig();
$collid = $_POST["collid"];
$hPrefix = $_POST['lhprefix'];
$hMid = $_POST['lhmid'];
$hSuffix = $_POST['lhsuffix'];
$lFooter = $_POST['lfooter'];
$occIdArr = $_POST['occid'];
$rowsPerPage = $_POST['rpp'];
$speciesAuthors = array_key_exists('speciesauthors', $_POST) && $_POST['speciesauthors'] ? 1 : 0;
$showcatalognumbers = array_key_exists('catalognumbers', $_POST) && $_POST['catalognumbers'] ? 1 : 0;
$useBarcode = array_key_exists('bc', $_POST) ? $_POST['bc'] : 0;
$useSymbBarcode = array_key_exists('symbbc', $_POST) ? $_POST['symbbc'] : 0;
$barcodeOnly = array_key_exists('bconly', $_POST) ? $_POST['bconly'] : 0;
$action = array_key_exists('submitaction', $_POST) ? $_POST['submitaction'] : '';
$exportEngine = '';
$exportExtension = '';
示例5: testLoadConfig
/**
* Test load config
*/
public function testLoadConfig()
{
$expected = array('compatibility' => true, 'zipClass' => 'ZipArchive', 'pdfRendererName' => 'DomPDF', 'pdfRendererPath' => '', 'defaultFontName' => 'Arial', 'defaultFontSize' => 10);
// Test default value
$this->assertEquals($expected, Settings::loadConfig());
// Test with valid file
$this->assertEquals($expected, Settings::loadConfig(__DIR__ . '/../../../phpword.ini.dist'));
// Test with invalid file
$this->assertEmpty(Settings::loadConfig(__DIR__ . '/../../../phpunit.xml.dist'));
}
示例6: downloadWord
public function downloadWord()
{
// echo COMMON_PATH . 'Org/PhpWord/Autoloader.php';exit;
require_once COMMON_PATH . 'Org/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
\PhpOffice\PhpWord\Settings::loadConfig();
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$header = array('size' => 16, 'bold' => true);
$styleTable = array('borderSize' => 6, 'borderColor' => '000000', 'cellMargin' => 80, 'width' => '100%');
$styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
$styleCell = array('align' => 'center');
$fontStyle = array('bold' => true, 'align' => 'center');
$section->addText("用戶相關", $header);
$phpWord->addTableStyle('Table', $styleTable);
$table = $section->addTable('Table');
$table->addRow(30);
$table->addCell(2000, $styleCell)->addText("字段", $fontStyle);
$table->addCell(1000, $styleCell)->addText("類型", $fontStyle);
$table->addCell(800, $styleCell)->addText("必選", $fontStyle);
$table->addCell()->addText("說明", $fontStyle);
for ($i = 1; $i <= 8; $i++) {
$table->addRow();
$table->addCell(2000)->addText("userTel");
$table->addCell(1000)->addText("字符串");
$table->addCell(800)->addText("是");
$table->addCell()->addText(htmlspecialchars("手機號碼"));
}
$section->addPageBreak();
$fileName = "word報表" . date("YmdHis") . ".docx";
// header("Content-type: application/vnd.ms-word");
// header("Content-Disposition:attachment;filename=".$fileName.".docx");
// header('Cache-Control: max-age=0');
$phpWord->save($fileName, 'Word2007');
}