Page 1 of 1

NumberingDefinitionPart : restart

PostPosted: Tue Jan 05, 2010 4:35 pm
by shyam.ramesh
I have couple queries regarding the method

NumberingDefinitionsPart : long restart(long numId, long ilvl, long val)


Q1. When should this be called?. Only When a new list starts or for all lists at any level?

Q2. When exporting html to docx we have a numbering def with abstractNumId 1 for OL can we pass the 1 for numId parameter for all ordered lists at all levels.?

Q3. This method gives new numId whenever it is called , will it automatically reuse existing abstractNumId?



Thanks in Advance,
krithi

Re: NumberingDefinitionPart : restart

PostPosted: Wed Jan 06, 2010 9:40 am
by jason
shyam.ramesh wrote:Q1. When should this be called?. Only When a new list starts or for all lists at any level?


It can be called when you want to restart numbering, re-using an existing abstract list. For example, you might use it in the following:

1. Some text
2. More text
An intervening paragraph.
1. Restarted with this item
2. Next item


as opposed to:

1. Some text
2. More text
An intervening paragraph.
3. Not Restarted
4. Next item


shyam.ramesh wrote:Q2. When exporting html to docx we have a numbering def with abstractNumId 1 for OL can we pass the 1 for numId parameter for all ordered lists at all levels.?


No, the numId you pass has to point to eg w:num/@w:numId="1", not directly to a w:abstractNum element.

shyam.ramesh wrote:Q3. This method gives new numId whenever it is called , will it automatically reuse existing abstractNumId?


Yes.

There's a description of how numbering works in the OpenXML spec, and also in the RTF spec. Perhaps have a look at that for further details...

Re: NumberingDefinitionPart : restart

PostPosted: Wed Jan 06, 2010 10:28 am
by shyam.ramesh
My html has
1. List1 item1
2. List1 item2
An intervening paragraph.
a. List2 item1
b. List2 item2


I have a scenario like this. my AbstractNumId (1) which handles OL will have only decimal at level 0 , but now I need an NumId which has lowerAlpha at level 0.

1. Should we call restart for both List1 and List2
2. Should I pass numId=1 when calling restart() for both the lists?
3. If I pass numId=1 for both list1 and list2 they all have lowerAlpha in the final docx?

regards,
krithi

Re: NumberingDefinitionPart : restart

PostPosted: Wed Jan 06, 2010 11:45 am
by jason
shyam.ramesh wrote:I have a scenario like this. my AbstractNumId (1) which handles OL will have only decimal at level 0 , but now I need an NumId which has lowerAlpha at level 0.


You'll need to define a second list which uses lowerAlpha.

In principle, you could do this either by overriding the existing abstract list with the lowerAlpha style, or by defining a new abstract list which uses lowerAlpha and associated override (identity).

Overriding would only really be appropriate if you wanted to do something like

1. dfadh
2. Asghas
c. adfhad
d. asgasgs

Either way, you'll need to write your own code. The easiest way is to generate the numbering you want in Word, and then either use that numbering part, or use XmlUtils.unmarshalString on the relevant definition.

Re: NumberingDefinitionPart : restart

PostPosted: Thu Jan 07, 2010 7:22 am
by shyam.ramesh
I did that by reusing AbstractNumId but overriding numfmt.

Thank you for your detailed reply.

regards,
krithi