1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/colin_86-MDword

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Внести вклад в разработку кода
Синхронизировать код
Отмена
Подсказка: Поскольку Git не поддерживает пустые директории, создание директории приведёт к созданию пустого файла .keep.
Loading...
README.md

MDword

中文文档

Project General Name

Template: a word which will be revised.
Block: the part which will be replaced or cloned.

Project Introduction

Main Use: to generate word dynamically.
Advantage: focus only on dynamic data and logic, rather than adjusting the style, which can modulate the template with the help of office word.

Comparison between MDword & PHPword

  • Similarities

  1. PHP Package.
  2. Both can be used to generate office word.
  • Differences

  1. PHPword concentrates on writing elements one by one. However, it is more powerful and efficient for Mdword just to revise them on the template.
  2. For updating text styles, adding covers, headers and footers, MDword just modifies the template by office word, while PHPword complicate the task-adjusting every element.
  3. Directories(Table of content) can be automatically generated.

Tutotials

  • Installation

// Method 1
composer require mkdreams/mdword
// Method 2, Autoloading Template
require_once('Autoloader.php');
  • Add annotations or use “${value/}” to the template. Please note that there is a “/” at the end.

image

// New class,load template
$TemplateProcessor = new WordProcessor();
$template = 'temple.docx';
$TemplateProcessor->load($template);

// Set Value
$TemplateProcessor->setValue('value', 'r-value');

// Clone 
$TemplateProcessor->clones('people', 3);

$TemplateProcessor->setValue('name#0', 'colin0');
$TemplateProcessor->setValue('name#1', [
    ['text'=>'colin1','style'=>'style','type'=>MDWORD_TEXT],
    ['text'=>1,'type'=>MDWORD_BREAK],
    ['text'=>'86','style'=>'style','type'=>MDWORD_TEXT]
]);
$TemplateProcessor->setValue('name#2', 'colin2');

$TemplateProcessor->setValue('sex#1', 'woman');

$TemplateProcessor->setValue('age#0', '280');
$TemplateProcessor->setValue('age#1', '281');
$TemplateProcessor->setValue('age#2', '282');

// set value for image
$TemplateProcessor->setImageValue('image', dirname(__FILE__).'/logo.jpg');

// Delete a paragraph
$TemplateProcessor->deleteP('style');

// Save
$rtemplate = __DIR__.'/r-temple.docx';
$TemplateProcessor->saveAs($rtemplate);
  • Result

image

  • GIFs

image

More samples

Communication

Note: Exchange idea on MDword.

image

Project Plans

Комментарии ( 0 )

Вы можете оставить комментарий после Вход в систему

Введение

MDword — это проект динамической генерации документов Word на PHP; движок шаблонов Word. Развернуть Свернуть
PHP и 2 других языков
Apache-2.0
Отмена

Обновления

Пока нет обновлений

Участники

все

Недавние действия

Загрузить больше
Больше нет результатов для загрузки
1
https://api.gitlife.ru/oschina-mirror/colin_86-MDword.git
git@api.gitlife.ru:oschina-mirror/colin_86-MDword.git
oschina-mirror
colin_86-MDword
colin_86-MDword
main