This project has moved and is read-only. For the latest updates, please go here.

Help with ProcessItem(). Please!

Oct 18, 2011 at 5:16 AM

I've been trying to resolve the bugs with ordered and unordered lists. The first bug is that each list starts with one higher than the last item in the previous list. The second bug is that if a document contains both ordered and unordered lists, the unordered lists become ordered lists.

The method I'm focusing on is NumberingListStyleCollection.ProcessItem(). It seems to return the ID of the number definition. However, it seems like it's always returning the same number. The only way it generates a new number ID is when margins are set in the markup.

Could you help me understand why you would only create a new number ID when margins are set? If I could get some more information, perhaps I could fix these issues for you.


Oct 18, 2011 at 5:27 AM
Edited Oct 18, 2011 at 5:16 PM

Looks like the issue with bulleted lists becoming numbered lists is because I'm creating new instances of HtmlConverter for each block. While this doesn't sound like a good approach, it kind of made sense given the structure of my code.

I reworked my code to use a single instance of HtmlConverter and now bulleted lists remain bulleted.

However, this does not resolve the problem where lists do not restart at one. It seems like the code has this right and I'm not yet able to see what is causing this.

Oct 18, 2011 at 6:20 PM

Looks like one fix to the issue of numbers not restarting is to add the following code near the bottom of BeginList().

Numbering numbering = mainPart.NumberingDefinitionsPart.Numbering;
    new NumberingInstance(
        new AbstractNumId() { Val = absNumId },
        new LevelOverride() {
            StartOverrideNumberingValue = new StartOverrideNumberingValue() { Val = 1 }
    ) { NumberID = currentNumId });

However, there is still some strangeness. For example, if I drag the list left or right, it still drags all other numbered lists with it. It still thinks they are part of the same list.

I'd love to know what is happening here if anyone knows. This link has a comment that says to "Make sure every w:num points to a unique w:abstractNum", which doesn't sound right.

Mar 29, 2012 at 4:17 PM

I have a similar issue, I have HTML with both bulleted and number lists in it, and they are all swapping, all of the bulleted lists are numbered and all the numbered lists are bulleted.  I am only using one instance of HtmlConverter.  I can't seem to figure out what happens after the tags in HTML are parsed.