Comments (18)
Hi @juzi, where did you have this branch ? I haven't found it.
Could you give a me a code for testing your problem ? Thanks for advance.
from phpword.
Branch "custom-numbered-lists" : https://github.com/RLovelett/PHPWord2/tree/custom-numbered-lists with this commit : https://github.com/RLovelett/PHPWord2/commit/eaffca7dea15e365c095571d0497cef48e924059
from phpword.
Sorry for the late reply, I think I got the branch from
https://github.com/RLovelett/PHPWord2/commit/1a6c6851f0d2444245f457c245d717ab18084672
at least that's what an e-mail from August 2013 says...
from phpword.
@Progi1984 I'll test this
from phpword.
I've tested the bug with the current develop branch. The code behaved as expected. No bug found. Below is the test code.
The test code try to mimic the retrieval of records from database and create individual document for each record. I mixed records that have images and not. If PHPWord_Media
does not reset, the subsequent document should still have images from the previous document.
// First document
$rows = array(
array(
'name' => 'Progi1984',
'avatar' => 'http://gravatar.com/avatar/16023066ffed311303d907c9d9b756b1'
),
array('name' => 'Ivan Lanin'),
array(
'name' => 'Gabriel Bull',
'avatar' => 'http://gravatar.com/avatar/7324439ccd29915db5c69f1caac65503'
),
array('name' => 'Roman Syroeshko'),
array(
'name' => 'Brandon Skrtich',
'avatar' => 'http://gravatar.com/avatar/2120eee8d13f0b9be90de3706e837f61'
),
);
$i = 0;
foreach ($rows as $row) {
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$section->addText($row['name']);
$section->addTextBreak();
if (isset($row['avatar'])) {
$section->addMemoryImage($row['avatar']);
} else {
$section->addText('No avatar.');
}
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save((++$i) . '-' . $row['name'] . '.docx');
}
from phpword.
@juzi Could you test your code with the develop branch and feedback us ?
from phpword.
Yes, will do.
It's a year ago I had the problem, so I'll first have to get back into it.
thanks for your efforts.
from phpword.
Thanks @juzi. We're trying to get PHPWord development running again :)
from phpword.
Need a little help. My code produces
Fatal error: Call to undefined method PHPWord_Style_Paragraph::setIndentions() in /home/jzimmer/git/25/mod/offlinequiz/docxlib.php on line 425
maybe that was a special feature in the GIT branch "custom-numbered-lists"?
The code that produces the error is:
// Define custom list item style for question answers
$level1 = new PHPWord_Style_Paragraph();
$level1->setTabs(new PHPWord_Style_Tabs(array(
new PHPWord_Style_Tab('clear', 720),
new PHPWord_Style_Tab('num', 360)
)));
$level1->setIndentions(new PHPWord_Style_Indentation(array(
'left' => 360,
'hanging' => 360
)));
from phpword.
Use:
$level1->setIndent(360);
$level1->setHanging(360);
from phpword.
Next problem. The following classes and methods are missing:
class PHPWord_Numbering_AbstractNumbering
was in my old code in PHPWord/Numbering/AbstractNumbering.php
method
PHPWord::addNumbering()
was in my old code in PHPWord.php
So it looks like the "custom-numbered-lists" has not been merged into develop.
How do we proceed?
Cheers
from phpword.
We better call @RLovelett to the discussion :)
The best way is to have him fetch the latest version of develop branch, merge it with his fork, and submit a pull request.
I'm not promising anything, but I'll look at his fork.
from phpword.
I'm moving this issue to next milestone because we are scheduling for release soon.
from phpword.
Some news from @RLovelett ?
from phpword.
Sorry for not seeing this. Unfortunately, I am not following what the problem is. Is the problem that PHPWord::addNumbering
no longer exists?
(Also, yeah its been a bit since I have worked on the code. I will have to look at it for a bit to get back up to speed).
from phpword.
Issue #10 still not resolved :) I'll look at your code and see how we can integrate it with the current PHPWord. Thanks.
from phpword.
@RLovelett: The problem is that I took the code mentioned above from your fork, but, accidentally, submitted the Issue in the main project, i.e. here. However, your branch "custom-numbered-lists" has not been integrated.
@ALL: my code is working right now and I don't necessarily need to upgrade. So don't spend too much time and energy into this. Of course, it would be nice to have the latest version of PHPWord, but I can wait.
from phpword.
I close this issue and will try to work on one of the oldest issue for PHPWord: #10. Thanks.
from phpword.
Related Issues (20)
- Images produced by templateProcessor->setImageValue look different in Windows versus Mac HOT 1
- Reader ERROR -> libxml_disable_entity_loader() is deprecated in PHP8
- TemplateProcessor deleteBlock is not working HOT 1
- Extension for PHPWord/src/PhpWord/IOFactory.php::extractVariables
- Contents of the cells are not vertically centered
- cloneBlock property does not function properly with files exceeding 145KB in the template.
- Invalid image: zip:///tmp/......../iamge4.png
- Incorrect variable naming conventions
- Replace all image by their alttext attribute
- Race condition in ZipArchive::$tempDir
- When using addHtml function, the width of the image is not measured in pt
- RTF increases support for Chinese reading
- Corrupted file after SaveAs from templateProcessor
- When I've tried to use it i'd get the error: "Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) ". I've modified the amount of memory via ini_set but the error continues
- Error: Class "ZipArchive" not found (0) En el archivo I:\MisWebs\test\vendor\phpoffice\phpword\src\PhpWord\Shared\ZipArchive.php en la línea: 138 HOT 1
- not adding header and footer on pdf:(dompdf and mpdf) HOT 3
- setImageValue added image doesn't have common image properties
- Uncaught ValueError: Invalid or uninitialized Zip object
- Avoid page break inside table
- Why not use a better HTML parser?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpword.