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

Bugfix: Look for the paragraph number properties in the style as well #251

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ROM-Knowledgeware
Copy link

This commit also adds support for style inheritance (the 'basedOn' property)

@ROM-Knowledgeware ROM-Knowledgeware changed the title Bugfix: Look for the paragraph number properties in the style as wellNumber properties Bugfix: Look for the paragraph number properties in the style as well Jul 25, 2018
@XceedBoucherS
Copy link
Collaborator

Hi,
Can you submit a sample using the code you are committing to better understand the reason of this fix ?
Thank you.

@ROM-Knowledgeware
Copy link
Author

Sure, here is a sample that demonstrate the cases that my patch fixes:
NumberingSample.docx

Note that the sample contains a first paragraph that is not part of a list (numId=0), however, currently Paragraph.IsListItem returns True for this paragraph, this is one of the bugs that my patch fixes.
The rest of the paragraphs are part of a list, but Paragraph.IsListItem returns False for some of them, my patch fixes this as well.

@XceedBoucherS
Copy link
Collaborator

Ok, Thank you, we will have a look at this.

@XceedBoucherS
Copy link
Collaborator

Hi,
We can see in your first item that the ooxml contains:
<w:p> <w:pPr> <w:numPr> <w:ilvl w:val="12"/> <w:numId w:val="0"/> </w:numPr> <w:r> <w:t>Not a List Item</w:t> </w:r> </w:p>

The doc says : "A value of 0 for the val attribute shall never be used to point to a numbering definition instance, and shall instead only be used to designate the removal of numbering properties at a particular level in the style hierarchy (typically via direct formatting)."

So a numId with val of 0 is a ListItem, without the number.
We need to consider it so that the following item in the List will increment its number accordingly (at the difference that the first ListItem won't display a number).

I understand that it looks like its not a ListItem, but it needs to be considered it as a ListItem.

Thank you.

@ROM-Knowledgeware
Copy link
Author

Hi,

So a numId with val of 0 is a ListItem, without the number.
We need to consider it so that the following item in the List will increment its number accordingly

You are misinterpreting the definition, when a numId has a value of 0 it's as-if there are no numbering properties, and we DO NOT increment any number, we do not even have a number to increment because there is no list associated with the paragraph.

I have attached an example so you could better understand the correct interpretation:
Headings_Demonstration.docx

As you can see in the example, the first paragraph with the Heading1 style has a numId set to 0,
so the second paragraph is actually the first item on the list, and is numbered 1 accordingly.

@XceedBoucherS
Copy link
Collaborator

Hi,

You are right, this will be fixed in v1.6.
Thank you.

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

Successfully merging this pull request may close these issues.

None yet

2 participants