Add ability to restart numbering by yurac · Pull Request #210 · python-openxml/python-docx
yurac
mentioned this pull request
Hi @yurac. I'm sorry to bother you. I'm trying to get ordered list resetting working, but attempting to do so while using the main python-docx distribution in my environment for now (waiting until such time as your patch, or a similar one, is incorporated).
Anyway, I just copy/pasted what you've got going on here: #25, and I'm trying to simply use it directly in my script.
However, my elements aren't renumbering between separated ordered lists, and I'm a bit stumped. Can I beg three minutes of your time?
Here's my clumsy attempt to use your method in-line in my script:
https://gist.github.com/photuris/8f71166deec7f8f5a774
No errors, just nothing's happening (I'd rather have errors). My two lists simply continue numbering, 1 2 3 4 5 6, rather than 1 2 3 1 2 3.
Thanks in advance! I'll be forever in your debt.
Hi,
I am not sure I understand your code. You can take my pull request as is
together with the example and see if it works for you. If it does not, you
will have to create a docx template corresponding to the example. Such as
adding there abstract numbering with id "10" as used in the example. Then
you can continue from there. You will probably have to read through
python-docx code and some of docx oxml documentation. There is another
project - olebole/python-docx that has a different solution for restart
numbering
Hi @yurac https://github.com/yurac. I'm sorry to bother you. I'm trying
to get ordered list resetting working, but attempting to do so while using
the main python-docx distribution in my environment for now (waiting until
such time as your patch, or a similar one, is incorporated).
Anyway, I just copy/pasted what you've got going on here: #25
#25, and I'm trying
to simply use it directly in my script.
However, my elements aren't renumbering between separated ordered lists,
and I'm a bit stumped. Can I beg three minutes of your time?
Here's my clumsy attempt to use your method in-line in my script:
https://gist.github.com/photuris/8f71166deec7f8f5a774
No errors, just nothing's happening (I'd rather have errors). My two lists
simply continue numbering, 1 2 3 4 5 6, rather than 1 2 3 1 2 3.
Thanks in advance! I'll be forever in your debt.
—
Reply to this email directly or view it on GitHub
#210 (comment)
.
Ok, I figured it out.
- I had to poke around in the xml source for my template file, to figure
out that the abstract numbering ID I needed was "12." So I hard-coded that
in. - I created a function called _reset_list() which manually adds XML
elements to the first item in my list, to reset the numbering (which I
deduced by poking around on the OpenXML spec on MSDN). I call this function
on the first iteration of my item list.
Ugly, but it works, so for the time being I'm satisfied.
(Tangentially, I used a similar manual XML manipulation technique to edit
my template's header, found in headers1.xml in the source document).
Thank you for taking the time to respond.
On Sat, Jan 30, 2016 at 9:46 AM, yurac notifications@github.com wrote:
Hi,
I am not sure I understand your code. You can take my pull request as is
together with the example and see if it works for you. If it does not, you
will have to create a docx template corresponding to the example. Such as
adding there abstract numbering with id "10" as used in the example. Then
you can continue from there. You will probably have to read through
python-docx code and some of docx oxml documentation. There is another
project - olebole/python-docx that has a different solution for restart
numberingHi @yurac https://github.com/yurac. I'm sorry to bother you. I'm trying
to get ordered list resetting working, but attempting to do so while using
the main python-docx distribution in my environment for now (waiting until
such time as your patch, or a similar one, is incorporated).Anyway, I just copy/pasted what you've got going on here: #25
#25, and I'm trying
to simply use it directly in my script.However, my elements aren't renumbering between separated ordered lists,
and I'm a bit stumped. Can I beg three minutes of your time?Here's my clumsy attempt to use your method in-line in my script:
https://gist.github.com/photuris/8f71166deec7f8f5a774No errors, just nothing's happening (I'd rather have errors). My two lists
simply continue numbering, 1 2 3 4 5 6, rather than 1 2 3 1 2 3.Thanks in advance! I'll be forever in your debt.
—
Reply to this email directly or view it on GitHub
<
#210 (comment).
—
Reply to this email directly or view it on GitHub
#210 (comment)
.
Good to hear that you got it working. I also had to spend some time to make
it work. What I did is a script that converts a subset of asciidoc to docx.
Works good for me since then.
On Feb 1, 2016 9:47 PM, "Joshua Pruitt" notifications@github.com wrote:
Ok, I figured it out.
- I had to poke around in the xml source for my template file, to figure
out that the abstract numbering ID I needed was "12." So I hard-coded that
in.- I created a function called _reset_list() which manually adds XML
elements to the first item in my list, to reset the numbering (which I
deduced by poking around on the OpenXML spec on MSDN). I call this function
on the first iteration of my item list.Ugly, but it works, so for the time being I'm satisfied.
(Tangentially, I used a similar manual XML manipulation technique to edit
my template's header, found in headers1.xml in the source document).Thank you for taking the time to respond.
On Sat, Jan 30, 2016 at 9:46 AM, yurac notifications@github.com wrote:
Hi,
I am not sure I understand your code. You can take my pull request as is
together with the example and see if it works for you. If it does not,
you
will have to create a docx template corresponding to the example. Such as
adding there abstract numbering with id "10" as used in the example. Then
you can continue from there. You will probably have to read through
python-docx code and some of docx oxml documentation. There is another
project - olebole/python-docx that has a different solution for restart
numberingHi @yurac https://github.com/yurac. I'm sorry to bother you. I'm
trying
to get ordered list resetting working, but attempting to do so while
using
the main python-docx distribution in my environment for now (waiting
until
such time as your patch, or a similar one, is incorporated).Anyway, I just copy/pasted what you've got going on here: #25
#25, and I'm
trying
to simply use it directly in my script.However, my elements aren't renumbering between separated ordered lists,
and I'm a bit stumped. Can I beg three minutes of your time?Here's my clumsy attempt to use your method in-line in my script:
https://gist.github.com/photuris/8f71166deec7f8f5a774No errors, just nothing's happening (I'd rather have errors). My two
lists
simply continue numbering, 1 2 3 4 5 6, rather than 1 2 3 1 2 3.Thanks in advance! I'll be forever in your debt.
—
Reply to this email directly or view it on GitHub
<.
—
Reply to this email directly or view it on GitHub
<
#210 (comment).
—
Reply to this email directly or view it on GitHub
#210 (comment)
.
Hi, first of all thanks for all your work.
What is the state of this pull request? Is something missing or not working correctly? I would be very interested in having this feature on master :-)
Best, Andi
Hi,
It works for me but requires some changes in the user docx template.
Would be nice if this or other solution is integrated into python-docx.
Best,
Yuri
On Mon, Jun 6, 2016 at 12:43 PM, Andreas Kobler notifications@github.com
wrote:
Hi, first of all thanks for all your work.
What is the state of this pull request? Is something missing or not
working correctly? I would be very interested in having this feature on
master :-)Best, Andi
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#210 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABCdOLmLBcX6obEwlNkfjjjyu6ispOHwks5qI-vJgaJpZM4GC5wB
.
Yuri Chernyavsky added 2 commits
November 22, 2016 10:58Any update on this, is there a fork to check, there are no commits in the Master branch for 2 years.
It's an old PR, but it would be really nice if python-docx could support restating a number list. Is there anything left to be done for this PR to be merged? I can help if you want.
这是一个旧的 PR,但如果可以支持重述数字列表,那就太好了。合并此 PR 还需要做些什么吗?如果你愿意,我可以帮忙。
python-docx
hello i want to achieve this:
a xxxx
b xxxx
c xxxx
a yyy
b yyy
c yyy
can anyone help me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters