Skip to content
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

Automatic numbering TOC #193

Closed
fhaubner opened this issue Apr 7, 2014 · 9 comments · Fixed by #198
Closed

Automatic numbering TOC #193

fhaubner opened this issue Apr 7, 2014 · 9 comments · Fixed by #198

Comments

@fhaubner
Copy link

fhaubner commented Apr 7, 2014

Hallo,

is it possible to insert automatic numbering for the TOC Items?
I looked into the TOC Files but couldn't find any way to do this.

Thanks
Florian

@ivanlanin
Copy link
Contributor

Is it the TOC items or the Headings that you want to give automatic numbering?

@fhaubner
Copy link
Author

fhaubner commented Apr 7, 2014

It's the Headings I want to give automatic numbering. I only found the code for the headings in the TOC example.

@ivanlanin
Copy link
Contributor

This feature will depend on the capability to write numbering.xml file dynamically. Currently, we write it as a static file, so I'm afraid you can't get what you need now. This is one of the oldest issue (#10) and I'm planning to work on it within one or two weeks from now.

@fhaubner
Copy link
Author

fhaubner commented Apr 7, 2014

I already had a look at the numbering.xml file some hours ago but as I'm not that used to the word-format it was already hard to identify the parts of my document.
Sounds good, thanks a lot for your help :)

@ivanlanin ivanlanin modified the milestones: 0.11.0, 1.0.0, Next Apr 13, 2014
@ivanlanin ivanlanin modified the milestones: 0.11.0, 1.0.0 May 30, 2014
@ivanlanin ivanlanin self-assigned this May 30, 2014
ivanlanin added a commit that referenced this issue May 30, 2014
ivanlanin added a commit that referenced this issue May 30, 2014
@ivanlanin
Copy link
Contributor

Hi @fhaubner. Please get the latest develop branch and use the following code:

$phpWord->addNumberingStyle(
    'hNum',
    array('type' => 'multilevel', 'levels' => array(
        array('pStyle' => 'Heading1', 'format' => 'decimal', 'text' => '%1'),
        array('pStyle' => 'Heading2', 'format' => 'decimal', 'text' => '%1.%2'),
        array('pStyle' => 'Heading3', 'format' => 'decimal', 'text' => '%1.%2.%3'),
        )
    )
);
$phpWord->addTitleStyle(1, array('size' => 16), array('numStyle' => 'hNum', 'numLevel' => 0));
$phpWord->addTitleStyle(2, array('size' => 14), array('numStyle' => 'hNum', 'numLevel' => 1));
$phpWord->addTitleStyle(3, array('size' => 12), array('numStyle' => 'hNum', 'numLevel' => 2));

$section->addTitle('Heading 1', 1);
$section->addTitle('Heading 2', 2);
$section->addTitle('Heading 3', 3);

See or run Sample_14_ListItem.php to get the working sample. When you have time to check, please confirm that this is working and close the issue. Thanks.

@ivanlanin ivanlanin modified the milestones: 0.12.0, 0.11.0 Jun 1, 2014
@ivanlanin
Copy link
Contributor

@fhaubner Can you confirm that this is working so that we can close this issue? Thanks.

@ivanlanin
Copy link
Contributor

@fhaubner Any news? Can we close this issue? Thanks.

@fhaubner
Copy link
Author

Hi,

sorry for the late reply. I did not have much time since I was moving home from abroad and had a lot to organize the last weeks. Thanks for your efforts, you can close the issue.

Best regards

Florian

Von: Ivan Lanin [mailto:[email protected]]
Gesendet: Samstag, 14. Juni 2014 05:37
An: PHPOffice/PHPWord
Cc: fhaubner
Betreff: Re: [PHPWord] Automatic numbering TOC (#193)

@fhaubner https://github.com/fhaubner Any news? Can we close this issue? Thanks.


Reply to this email directly or view it on GitHub #193 (comment) . https://github.com/notifications/beacon/5937492__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxODMzNjIyNiwiZGF0YSI6eyJpZCI6Mjk0NDY3MjB9fQ==--e94586c5462879050848803267b5e0eb0ccb918b.gif

@ivanlanin
Copy link
Contributor

Thanks. Welcome home :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants