shadz3rg / php-stamp Goto Github PK
View Code? Open in Web Editor NEWThe XSL-way templating library for Word DOCX documents.
License: MIT License
The XSL-way templating library for Word DOCX documents.
License: MIT License
Как отключить принудительное кеширование используемого шаблона? Есть ли, какие опции?
I would like use library without minimum-stability dev
. Now, it has been more than 3 years, and it's time that for version.
Давно пора, даже если это прототип :) Композер будет намного удобнее использовать.
приветствую
Если в строке, куда идет вставка данных, присутствуют кавычки-ёлочки («»), то не происходит подстановка значений, а в конечном документе остается [[full_name]].
yii 2.0.30
php 7.3.9
Hi, thank you for great lib!
Any ideas why double brackets {{example}}
dont work? But single {example}
works fine.
$templator = new \PHPStamp\Templator($cachePath, ['{{','}}']);
Hi,
I am getting this issue on my localhost.
Error URL: https://imgur.com/a/OqLxMhO
Doc & PHP Template : https://filebin.net/tc76riowvwbzgrq5
My docx
-Template contains the placeholder [[brief.anschrift]]
which should be replaced by a multiline string:
Line 1
Line 2
Line 3
Line 4
The array passed to the $templator->render(...)
function looks like this:
$values = array(
'brief' => array( 'anschrift' => "Line1\r\nLine2\r\nLine 3\r\nLine 4" )
);
As a result, the placeholder [[brief.anschrift]]
has been replaced by...
Line1 Line2 Line 3 Line 4
I have also tried several variations with single quotes '
, double quotes "
, CRLF within code, \r
and \n
as you can see here:
$values = array(
'letter' => array(
'address_1' => "Line1\r\nLine2\r\nLine 3\r\nLine 4"
, 'address_2' => 'Line1\r\nLine2\r\nLine 3\r\nLine 4'
, 'address_3' => "Line1
Line2
Line 3
Line 4"
, 'address_4' => "Line1\rLine2\rLine 3\rLine 4"
, 'address_5' => "Line1\nLine2\nLine 3\nLine 4"
, 'address_6' => "Line1<br>Line2<br>Line 3<br>Line 4"
));
For testing purposes the docx
-Template contains the following placeholders:
And this is the result:
None of them returns the expected result. Am I missing something?
Question:
How can I pass a multi-line string containing CRLF
?
Мне разработчик сказал, что "в самом коде также есть со списками небольшая ошибка(будет работать на вин, но не на никс хостинге)". Так и случилось: списки перестали работать когда закинул с локального сервера на хостинг (OS Ubuntu (Linux)). Прошу ответить, что можно сделать, чтобы генерировались списки в шаблоне в том числе на никс серверах?
After the release of PHP 8.1.2, template generation stopped working, gives the following error: Uncaught TypeError: PHPStamp\Templator::searchAndReplace(): Argument #1 ($nodeList) must be of type DOMNodeList, bool given, called in. After a little research, we managed to find out that the problem is in the formation of the template in the file "Processor.php" line "35" $template->appendChild($document->documentElement);
How to solve this problem?
Столкнулся с проблемой, что размеры полей у исходного шаблона и выходящего документа различаются. В результате документ "съезжал" и не был похож на исходный.
Можно подумать в сторону либо выставления размеров идентичных исходному шаблону, либо добавить методы для прописывания полей дополнительно.
i have document:
[[current_date]]
text text
[[number_test]]
text text
[[пример_тест]]
save in format office open xml (docx) in libre office in .docx ext.
and get error:
Unexpected token, expected PHPStamp\Processor\Lexer::T_DOT, got PHPStamp\Processor\Lexer::T_STRING
how to fix?
It'll be nice to have templating ability in this document sections, isn't it?
Есть ли возможность вставки изображений динамически?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.