Adding Multiple Numbered List but number does not reset

Jan 9, 2014 at 10:17 PM
Here's my code:
var distinctAccounts = model.LineItems.Select(x => new
        {
            IaId = x.ToIaId,
            EntityName = x.ToEntity,
            AccountName = x.ToAccountName,
            AccountNumber=x.ToAccountNumber
        }).Distinct();

        foreach (var account in distinctAccounts)
        {
            document.InsertParagraph(string.Format("Account Name:\t\t{0}", account.EntityName)).Bold();
            document.InsertParagraph(string.Format("Account Number:\t\t{0}", account.AccountNumber)).Bold();
            var masterList = document.AddList(null, 1, ListItemType.Numbered, 1);

            var count = 0;
            foreach (var lineItem in model.LineItems.Where(x=> x.ToIaId == account.IaId))
            {
                document.AddListItem(masterList, "[Security]", 0, ListItemType.Numbered, count+1);
                var tempPara = masterList.Items[count];
                tempPara.Alignment = Alignment.left;
                tempPara.IndentationBefore = 2;
                tempPara.Bold();

                tempPara.ReplaceText("[Security]", string.Format("Security:\t\t{0}(ticker:{1})", lineItem.AssetDescription,lineItem.Ticker));
                tempPara.AppendLine(string.Format("Action:\t\t{0}",lineItem.TransactionAction));
                tempPara.AppendLine(string.Format("Amount:\t\t{0}", lineItem.AmountDisplay));

                tempPara.AppendLine("");

                count++;
            }
            document.InsertList(masterList);
        }
Basically this code runs just fine however an issue I can having is that when I insert the 2nd list the numbered list does not reset and starts at whatever number the previous list in the looped ended with. For example, if the previous list had 4 items then the next list will start with the number 5.

Anyone have any idea what's going on here?
Feb 13, 2014 at 1:27 PM
Hello Peter,
I am having the exact same issue and I was wondering if you were ever able to resolve this? If not, were you able to find a work around?

Thanks!