Continue numbering between lists when merging documents

I have multiple documents, each one containing one or more paragraphs that have list numbering set. When I merge these documents, I want to have the final document display all the paragraphs with continuous numbers.

Ideally, as I merge each document, I would like to specify if any lists in the document should continue numbering from the last number in the target document. That way, if I need to merge a document without numbering, and then add another document with a list that starts from #1.

Please see below for an example. The required numbering in the final document is highlighted in red:

I searched through your forums, but I
couldnt find anything that speaks of this. Please advise, as this is
an EXTREMELY important feature for my project.

Thanks in
advance for your time and support.

Content of Document 1:
------------------------

  1. Book of Spells
  2. Book of Wizards
  3. Book of Magic

Content of Document 2 (must continue number from previous list when merged together) :

------------------------

  1. Book of Football

  2. Book of Science

Content of Document 3 (no numbers in this document):

------------------------

The president of the United Stated is Obama. He was elected in Nov 2009.

Content of Document 4: (must continue number from #1
when merged together)
------------------------

  1. U.S. Political History
  2. Ancient Monuments

**Final Document after Merge (Required Format)
-----------------------------------------------

  1. Book of Spells

  2. Book of Wizards

  3. Book of Magic

  4. Book of Football

  5. Book of Science

The president of the United Stated is
Obama. He was elected in Nov 2009.

  1. U.S. Political History
  2. Ancient

Monuments**
------------------------------

Hi

Thanks for your request. if numbering is applied via style, then you can just append document with ImportFormatMode.UseDestinationStyles. In this case numbering will continuous. I created two sample document for you and attached final document produced using the following code:

Document doc1 = new Document(@"Test001\doc1.doc");
Document doc2 = new Document(@"Test001\doc2.doc");
doc1.AppendDocument(doc2, ImportFormatMode.UseDestinationStyles);
doc1.Save(@"Test001\out.doc");

Hope this helps.
Best regards.

Hi Alexey,

Thank you very much for your prompt response, that was fast !! your samples work just fine, although I havent explored the other part, where I need to RESTART from #1. But even within the part that you sent me, I was unable to achieve the same results with my documents. Your documents seem to work just fine, but when I include my documents, I see my documents continue to start with #1.

Can you PLEASE help me figure out the difference between your document and mine ? I notice that you said “if numbering is applied via style”, and I wonder if that has something to do with it.

I have enclosed sample documents that I use, as well as the end result. Your documents are also part of the final document.

also, fyi, I have Office 2007 installed on my machine, and an evaluation version of aspose.words, version 8.1.0.0

Hi Ashwin,

Thanks for your request. I created a simple video, which demonstrates the technique of creating documents. You should note only that both document should have style with the same name. Hope this helps. Please let me know if you need additional information, I will be glad to help you.
Best regards.

A post was split to a new topic: Continue numbering lists after joining documents