We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with Numbering Bullets

Hi,
I am Facing an issue in mail merging the document.
I am having a template which has items like

  1. item1
    2.item2
    After merging the data , the data is getting displayed like the below
    Actual Result:
    page 1
  2. item1
    2.item2
    page 2
    3.item1
    4.item2
    The Excepted Result
    page 1
    1.item1
    2.item2
    page2
    1.item1
    2.item2
    can any one please help me on this
    Advance Thanks…!
    Rajesh

This message was posted using Aspose.Live 2 Forum

Hi Rajesh,

Thanks for your request. I managed to reproduce the problem your reqeust has been linked to the appropriate issue. You will be notified as soon as it is resolved.
If your template consists of only one section, I suppose the workaround I suggested in another thread should work for you.
https://forum.aspose.com/t/95715
Please let me know if this does not work in your case.
Best regards.

Hi alexey ,

Thanks For your Quick Reply.

I have Saw the link which you have provided,it was solution for .net can you please provide a work around solution for java.

Advance Thanks…!

Rajesh

Hello

Thanks for your request. Please see the same code on Java bellow:

Document doc = new Document("C:\\Temp\\in.doc");
doc.getMailMerge().execute(resultSet);
// Loop through all section in the docuemnt
for (Section sect : doc.getSections())
{
    List tmpList = null;
    List newList = null;
    // Get collection of paragraps in the section
    NodeCollection paragraphs = sect.getChildNodes(NodeType.PARAGRAPH, true);
    // Loop through all paragraphs
    for (int i = 0; i < paragraphs.getCount(); i++)
    {
        Paragraph par = (Paragraph)paragraphs.get(i);
        if (par.isListItem())
        {
            if (!par.getListFormat().getList().equals(tmpList))
            {
                // Create new list
                newList = doc.getLists().addCopy(par.getListFormat().getList());
                // Store list in temporary variable
                tmpList = par.getListFormat().getList();
            }
            // Restart list.
            par.getListFormat().setList(newList);
        }
    }
}
doc.save("C:\\Temp\\out.doc");

Best regards,

Hi Alexey,

Thanks For ur reply…
i have tried the workaround solution you have provided it was not working.The data is not getting inserted into the document and the generated document is empty.

I have attached the document for ur reference.

can you please help me on this…

Hello

Thank you for additional information. I have tried one more time and all works fine on my side. I use the latest version of Aspose.Words for Java (4.0.2) and the following code:

// Open template
Document doc = new Document("C:\\Temp\\MV+Clear+Statement.doc");
ResultSet testTable = GetTestTable();
doc.getMailMerge().execute(testTable);
// Loop through all section in the docuemnt
for (Section sect : doc.getSections())
{
    List tmpList = null;
    List newList = null;
    // Get collection of paragraps in the section
    NodeCollection paragraphs = sect.getChildNodes(NodeType.PARAGRAPH, true);
    // Loop through all paragraphs
    for (int i = 0; i < paragraphs.getCount(); i++)
    {
        Paragraph par = (Paragraph)paragraphs.get(i);
        if (par.isListItem())
        {
            if (!par.getListFormat().getList().equals(tmpList))
            {
                // Create new list
                newList = doc.getLists().addCopy(par.getListFormat().getList());
                // Store list in temporary variable
                tmpList = par.getListFormat().getList();
            }
            // Restart list.
            par.getListFormat().setList(newList);
        }
    }
}
doc.save("C:\\Temp\\out.doc");

Please see the attached output document.
Also I think this demo will be useful for you:
https://github.com/aspose-words/Aspose.Words-for-.NET
Best regards,