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

Free Support Forum - aspose.com

Using Page Number I devided whole document into small document at that time bullet number getting disturb(reset)

I use this snippest to create small word document from large document at that time my bullet number getting disturb

public void ConvertContent()
{
    Aspose.Words.License licWord = new Aspose.Words.License();
    Stream strLicenscePath = new MemoryStream(Properties.Resources.Aspose_Words);
    licWord.SetLicense(strLicenscePath);

    Content.Position = 0;
    var wordloadoption = new Aspose.Words.Loading.LoadOptions() { LoadFormat = LoadFormat.Docx };
    Aspose.Words.Document doc = new Aspose.Words.Document(Content, wordloadoption);

    if (null != doc)
    {

        //need to divide the document into multiple docs
        if (this.dicSection != null && this.dicSection.Count > 0)
        {
            var last = dicSection.Last(); // {[Page 131-136, 131|6]}
            var lstarr = last.Value.Split('|'); //String 131 6
            foreach (var item in dicSection)
            {
                var arr = item.Value.Split('|');
                Document partialdoc = (Document)doc.Clone(false);
                if (!item.Equals(last))
                {
                    partialdoc = doc.ExtractPages(Int32.Parse(arr[0]) - 1, Int32.Parse(arr[1]));
                }
                else
                {
                    partialdoc = doc.ExtractPages(Int32.Parse(arr[0]) - 1, (doc.PageCount - Int32.Parse(lstarr[0])) + 1);
                }

                using (MemoryStream ms = new MemoryStream())
                {
                    partialdoc.FontInfos.EmbedTrueTypeFonts = true;
                    partialdoc.FontInfos.EmbedSystemFonts = true;
                    partialdoc.FontInfos.SaveSubsetFonts = true;

                    partialdoc.Save(@"C:\\Users\\abc\\Desktop\\partial.docx");
                }
            }
        }
        else
        {
            //entire document just saved using aspose
            using (MemoryStream ms = new MemoryStream())
            {
                doc.Save(ms, Aspose.Words.SaveFormat.Docx);
            }

        }
    }
}

Here in DicSection I give page number like this
[COVER PAGE, 1|1]
[TOC, 2|1]
[Page 3 to 4, 3|2]
[Balance sheet, 5|1]
[Income statement, 6|1]
[Comprehensive statement, 7|1]
[Stockholders equity, 8|2]
[Cash flow, 10|2]
[Page 12-20, 12|9]
[Page 21-30, 21|10]
[Page 31-40, 31|10]
[Page 41-50, 41|10]
[Page 51-60, 51|10]
[Page 61-70, 61|10]
[Page 71-80, 71|10]
[Page 81-90, 81|10]
[Page 91-100, 91|10]
[Page 101-110, 101|10]
[Page 111-120, 111|10]
[Page 121-130, 121|10]
[Page 131-136, 131|6]
TRY.docx (736.2 KB)
partial.docx (193.0 KB)
ExpectedOutput.png (307.2 KB)
Error.png (164.2 KB)

@Jayshiv1408 I cannot reproduce the problem on my side using the latest 23…3 version of Aspose.Words. I have used the following simplified code:

Document doc = new Document(@"C:\Temp\in.docx");
Document subDoc = doc.ExtractPages(131, 6);
subDoc.Save(@"C:\Temp\out.docx");

As I can see you are using an old 21.8 version. With this version the problem is really reproducible. So I would suggest you to update to the latest version of Aspose.Words.
It looks like your issue has been fixed per WORDSNET-23685, which was resolved in 22.5 version of Aspose.Words.

We purchase this license last year so we don’t want to Renew License for now ,
So there is any alternative solution for this problem.

@Jayshiv1408 Every Aspose license provides a 1-year subscription for free upgrades to any new Aspose.Words version that comes out.

You can check the license expiration date by opening the license file in Notepad (but take care not to modify and save the license file or it will no longer work) and checking the SubscriptionExpiry field.

<SubscriptionExpiry>20220218</SubscriptionExpiry>

It means that you can free upgrade to version of Aspose.Words published before 02/18/2022.

So if your license expiration date is after May 03 2022 (release date of 22.5 version), you can simply update to 22.5 version.

My Subscription got expire before 22.5 version release so is there any way to solve this without updating the license.

@Jayshiv1408 Unfortunately, there is no a good workaround of this issue in old version. The only way to resolve this using old version I can see is to calculate actual list items values and then reset StartAt value of the corresponding paragraphs’ list levels. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.UpdateListLabels();

// Set customer node id in the paragraphs, which are list items
// And collect their actual list label values.
List<Paragraph> listItems = doc.GetChildNodes(NodeType.Paragraph, true)
    .Cast<Paragraph>().Where(p => p.IsListItem).ToList();

Dictionary<int, int> paraIdToListItemValue= new Dictionary<int, int>();
int i = 0;
foreach (Paragraph item in listItems)
{
    item.CustomNodeId = i;
    paraIdToListItemValue.Add(item.CustomNodeId, item.ListLabel.LabelValue);
    i++;
}


// Extract content.
Document subDoc = doc.ExtractPages(131, 6);

// Reset start at value of the corresponding lists.
Dictionary<int, List<int>> updateListLevels = new Dictionary<int, List<int>>();
List<Paragraph> subDocListItems = subDoc.GetChildNodes(NodeType.Paragraph, true)
    .Cast<Paragraph>().Where(p => p.IsListItem).ToList();

foreach (Paragraph item in subDocListItems)
{
    int listId = item.ListFormat.List.ListId;
    int listLevel = item.ListFormat.ListLevelNumber;
    if (updateListLevels.ContainsKey(listId) && updateListLevels[listId].Contains(listLevel))
        continue;

    int startAt = paraIdToListItemValue[item.CustomNodeId];
    item.ListFormat.ListLevel.StartAt = startAt;

    if (!updateListLevels.ContainsKey(listId))
        updateListLevels.Add(listId, new List<int>());

    updateListLevels[listId].Add(listLevel);
}

subDoc.Save(@"C:\Temp\out.docx");

But I would suggest you to consider updating to the latest version of Aspose.Words.

In Same (TRY.docx) Document I use this snippest .But still bullet number missmatch issue is there

Document subDoc = doc.ExtractPages(121, 10);

Then I try this snippest in other document but still I am facing this issue .
Here when we set paraIdToListItemValue.Add(item.CustomNodeId, item.ListLabel.LabelValue) that time set value are
item.CustomNodeId = 74
, item.ListLabel.LabelValue = 4

and here

int startAt = paraIdToListItemValue[item.CustomNodeId];
item.ListFormat.ListLevel.StartAt = startAt;

in startAt i get 4 but in document bullet number set to 5
Error and Expected Output Screenshot.

@Jayshiv1408 As I have mentioned, unfortunately, there is no a good workaround of this issue in old version. So the proper solution would be to update to Aspose.Words higher than 22.5, where the original problem is resolved.

@alexey.noskov Hii I get temporary license for 23.3.0.0 but still I am facing issue for that

here is my snippest code

Aspose.Words.License licWord = new Aspose.Words.License();
string strLicenscePath = "D:\\DemoCodes\\ConsoleApp\\Resource\\Aspose.Words.NET.lic"; //Aspose Word lic path
licWord.SetLicense(strLicenscePath);
Document doc = new Document(@"C:\\Users\\ABC\\Desktop\\PetrolSourceFile.docx");
Document subDoc = doc.ExtractPages(30,10);
subDoc.Save(@"C:\\Users\\ABC\\Desktop\\Page 30-10New.docx");


@Jayshiv1408 Could you please attach your PetrolSourceFile.docx file here for testing?

PetrolSourceFile.docx (323.4 KB)

@Jayshiv1408 Thank you for additional information.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25146

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.