Problem Importing Number bullets list

I am currently evaluating Aspose.Word and have run into a problem with importing a list of number bullets.

The problem I am experiencing is that when I merge the a list of number bullets from a document to a document with bookmark the numbering of the list remains at 1. See below for the problem.

Source document

  1. Item 1
  2. Item 2
  3. Item 3

Destination document

1. Item 1
1. Item 2
1. Item 3

The list items are imported correctly in my test. Please provide a sample documents and a code snippet sufficient to reproduce the problem.

The code I'm using comes from one of the post in the forum. Atached are sample documents and codes.

Thanks.

On further testing, it was found that this bullets numbering problem only occurs when importing to cells in tables.

Thanks for additional info. It seems that list items need some additional processing when inserted on node-by-node basis. Please hold on a little longer. I am trying to compose a code sample that performs list handling correctly during insertion.

Ok, here is an updated InsertDocument method. Seems that it does the job perfectly now.

///

/// Inserts content of the external document after the specified node.

///

/// Node in the destination document where the external document content should be inserted.

/// Document to insert.

public void InsertDocument(Node node, Document doc)

{

Document dstDoc = node.Document;

Section insertedSection;

int index = node.ParentNode.ChildNodes.IndexOf(node);

foreach (Section section in doc.Sections)

{

insertedSection = (Section)dstDoc.ImportNode(section, true, ImportFormatMode.KeepSourceFormatting);

foreach (Node insertedNode in insertedSection.Body.ChildNodes)

{

// Only Paragraph or Table nodes can be inserted into Cell or Shape

if (insertedNode is Paragraph || insertedNode is Table)

{

// Do not insert node if it is a last empty paragarph in the section.

if (insertedNode is Paragraph && insertedNode == section.Body.LastChild && insertedNode.ToTxt().Equals(string.Empty))

break;

node.ParentNode.ParentNode.ChildNodes.Insert(++index, insertedNode.Clone(true));

}

}

}

}

Best regards,

Thanks a lot, it works now. Another question is how to export the bulleted text to plain text without loosing the numbering.

Exporting the bulleted text to plain text without loosing numbers or bullets is not possible in a curent version. We will probably implement this functionality in one of the future versions.

Is there a possible workaround for achieving that? Possible using DocumentVistor class?

Nope, DocumentVisitor won't help you with this. The problem is due to the fact that numbers are not stored in the document, they are calculated by MS Word during rendering. You need to write a complex analysis tool and parse the whole document to be able to do this yourself. We will probably implement it together with our rendering engine in our next major release.