GithubHelp home page GithubHelp logo

Comments (18)

Progi1984 avatar Progi1984 commented on May 4, 2024

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.

Progi1984 avatar Progi1984 commented on May 4, 2024

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.

juzi avatar juzi commented on May 4, 2024

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.

ivanlanin avatar ivanlanin commented on May 4, 2024

@Progi1984 I'll test this

from phpword.

ivanlanin avatar ivanlanin commented on May 4, 2024

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.

Progi1984 avatar Progi1984 commented on May 4, 2024

@juzi Could you test your code with the develop branch and feedback us ?

from phpword.

juzi avatar juzi commented on May 4, 2024

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.

ivanlanin avatar ivanlanin commented on May 4, 2024

Thanks @juzi. We're trying to get PHPWord development running again :)

from phpword.

juzi avatar juzi commented on May 4, 2024

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.

ivanlanin avatar ivanlanin commented on May 4, 2024

Use:

$level1->setIndent(360);
$level1->setHanging(360);

from phpword.

juzi avatar juzi commented on May 4, 2024

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.

ivanlanin avatar ivanlanin commented on May 4, 2024

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.

gabrielbull avatar gabrielbull commented on May 4, 2024

I'm moving this issue to next milestone because we are scheduling for release soon.

from phpword.

Progi1984 avatar Progi1984 commented on May 4, 2024

Some news from @RLovelett ?

from phpword.

RLovelett avatar RLovelett commented on May 4, 2024

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.

ivanlanin avatar ivanlanin commented on May 4, 2024

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.

juzi avatar juzi commented on May 4, 2024

@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.

ivanlanin avatar ivanlanin commented on May 4, 2024

I close this issue and will try to work on one of the oldest issue for PHPWord: #10. Thanks.

from phpword.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.