List is not getting resetted on document merge

Hi Aspose Team,
I’m merging 2 documents with list and list is not getting resetted in merged document even after using
ListFormat.List.IsRestartAtEachSection = true;

Program.zip (970 Bytes)

Attached sample POC.

@Meena_K,

Thanks for your inquiry. The List.IsRestartAtEachSection option is supported only in RTF, DOC and DOCX document formats and will be written to DOCX only if OoxmlCompliance is higher then Ecma376. Please check the following code snippet.

OoxmlSaveOptions option = new OoxmlSaveOptions();
option.Compliance = OoxmlCompliance.Iso29500_2008_Strict;

Doc.Save(MyDir + "1.docx", option);

OoxmlSaveOptions option = new OoxmlSaveOptions();
option.Compliance = OoxmlCompliance.Iso29500_2008_Strict;

mergedDoc.Save(MyDir + "MergedDocument.docx", option);

Hi Tahir,

I have used the above snippet of OoxmlSaveOptions and still the issue is reproducible.
Can you please help me in some other way of achieving.

@Meena_K,

Thanks for your inquiry. We tested the scenario using latest version of Aspose.Words for .NET 17.12 and have not found the shared issue. Please use Aspose.Words for .NET 17.12. Please check following modified methods. We have attached the output DOCX with this post for your kind reference. MergedDocument.zip (7.5 KB)

public static void MergeAllDocuments()
{
    try
    {
        DocumentCreation();
        Aspose.Words.Document mergedDoc = new Aspose.Words.Document();
        mergedDoc.RemoveAllChildren();
        foreach (KeyValuePair<string, string> item in itemList)
        {
            string fileName = item.Value;
            Aspose.Words.Document itemDoc = new Aspose.Words.Document(fileName);
            itemDoc.FirstSection.HeadersFooters.LinkToPrevious(false);
            mergedDoc.Cleanup();
            mergedDoc.AppendDocument(itemDoc, Aspose.Words.ImportFormatMode.UseDestinationStyles);
        }

        OoxmlSaveOptions option = new OoxmlSaveOptions();
        option.Compliance = OoxmlCompliance.Iso29500_2008_Strict;

        mergedDoc.Save(MyDir + "MergedDocument.docx", option);
    }
    catch
    {
    }
}

public static void Listlabel()
{
    try
    {
        Document Doc = new Document();
        Section sec = new Section(Doc);
        Doc.RemoveAllChildren();
        Body body = new Body(Doc);
        Paragraph List = ListCreation(Doc);
        body.AppendChild(List);
        sec.AppendChild(body);
        Doc.AppendChild(sec);

        OoxmlSaveOptions option = new OoxmlSaveOptions();
        option.Compliance = OoxmlCompliance.Iso29500_2008_Strict;

        Doc.Save(MyDir + "1.docx", option);
    }
    catch
    {
    }
}

Hi Tahir,

Using option.Compliance = OoxmlCompliance.Iso29500_2008_Strict;
causes compliance issue.

We are able to open the output documents only for MS Word 2013 and above versions. Can you please suggest some way of achieving the same in all versions of word.

@Meena_K,

Thanks for your inquiry. You can use OoxmlCompliance.Iso29500_2008_Transitional. Hope this helps you.

Using OoxmlCompliance.Iso29500_2008_Transitional, list restart is not working for version below 2013. Is there any workaround for this?

@Meena_K,

Thanks for your inquiry. Could you please share the MS Word version that you are using at your end? Thanks for your cooperation.

We are using Microsoft word 2010.

@Meena_K,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16379. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks for ticket creation. List was getting resetted until 17.9.0.0 version of Aspose words and after adding the Property List.IsRestartAtEachSection in 17.9.0.0, restart feature is breaking.

@Meena_K,

Thanks for your inquiry. We have tested the scenario using Aspose.Words 17.9 and noticed the same issue. Please share the output document generated by 17.9 and code example that you are using for investigation.

Tahir,

We have been using version 17.2 and now 17.10 version. Attached zip contains the output with 17.2 version where list is getting restarted and 17.10 version were list is not getting restarted along with the program file which I used as POC. List Restart.zip (14.0 KB)

@Meena_K,

Thanks for your inquiry. Please check the detail List.IsRestartAtEachSection property. Please use the following code snippet to save the document.

OoxmlSaveOptions options = new OoxmlSaveOptions();
options.Compliance = OoxmlCompliance.Iso29500_2008_Transitional;
Doc.Save(MyDir + "1.docx", options);

OoxmlSaveOptions options = new OoxmlSaveOptions();
options.Compliance = OoxmlCompliance.Iso29500_2008_Transitional;
mergedDoc.Save(MyDir + "MergedDocument.docx", options);

List.IsRestartAtEachSection with transitional is not working below version 2013 of words is what I have already stated the issue.

@Meena_K,

Thanks for your inquiry. We will inform you via this forum thread once this issue (WORDSNET-16379) is resolved. Thanks for your patience.

@Meena_K,

Thanks for your patience. It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-16379) as ‘Not a Bug’.

Restart at each section (w15:restartNumberingAfterBreak) is an property, which works for MS Word 2013 and later versions. It’s a normal behavior of properties with prefix “w15” : pre 2013 versions of MS Word does not display these features correctly.

@Meena_K,

We added overload of Document.AppendDocument method with ImportFormatOptions.KeepSourceNumbering parameter. You can use this method to achieve your requirement. Please read the following article.
Append with ImportFormatOptions