-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Word2007 writer does not reset PHPWord_Media::_sectionMedia #19
Comments
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. |
Branch "custom-numbered-lists" : https://github.com/RLovelett/PHPWord2/tree/custom-numbered-lists with this commit : https://github.com/RLovelett/PHPWord2/commit/eaffca7dea15e365c095571d0497cef48e924059 |
Sorry for the late reply, I think I got the branch from at least that's what an e-mail from August 2013 says... |
@Progi1984 I'll test this |
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 // 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');
} |
@juzi Could you test your code with the develop branch and feedback us ? |
Yes, will do. |
Thanks @juzi. We're trying to get PHPWord development running again :) |
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"?
|
Use: $level1->setIndent(360);
$level1->setHanging(360); |
Next problem. The following classes and methods are missing: class PHPWord_Numbering_AbstractNumbering method was in my old code in PHPWord.php So it looks like the "custom-numbered-lists" has not been merged into develop. Cheers |
We better call @RLovelett to the discussion :) |
I'm moving this issue to next milestone because we are scheduling for release soon. |
Some news from @RLovelett ? |
Sorry for not seeing this. Unfortunately, I am not following what the problem is. Is the problem that (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). |
Issue #10 still not resolved :) I'll look at your code and see how we can integrate it with the current PHPWord. Thanks. |
@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. |
I close this issue and will try to work on one of the oldest issue for PHPWord: #10. Thanks. |
I'm using the GIT branch "custom-numbered-lists" of your PHPWord code.
I'm generating several docx documents in a row inside my php module. The documents contain images. I realised that when generating the second document the PHPWord_Writer_Word2007 tried to access the images of the first document. I think this is due to the fact that the static information in PHPWord_Media is not reset.
I wrote a simple reset function and now everything works as expected.
I suppose such a method should actually be called when calling
PHPWord_IOFactory::createWriter(..., 'Word2007');
I don't know if this also affects other branches of the code.
The text was updated successfully, but these errors were encountered: