//
        // open and close the list numbering
        //

        #region private void OpenListNumbering()

        private void OpenListNumbering()
        {
            string groupname = string.Empty;
            StyleValue <string> grp;

            if (this.FullStyle.TryGetValue(StyleKeys.ListGroupKey, out grp))
            {
                groupname = grp.Value;
            }
            PDFListNumbering numbering = this.Component.Document.ListNumbering;

            numbering.PushGroup(groupname, this.FullStyle);
        }
            public string PushHeading(int index, string grpName, Style style)
            {
                //We add nulls in to the list of group names up to the index
                //So we have the complete list by index

                while (_registeredGroups.Count <= index)
                {
                    _registeredGroups.Add(UnregisteredGroup);
                    _registeredStyles.Add(UnregisteredStyle);
                }

                //Store the group and style in the lists at the index.

                _registeredGroups[index] = grpName;
                _registeredStyles[index] = style;

                // Reset all the known groups that are of a higher index (smaller headings)

                for (int i = index + 1; i < _registeredGroups.Count; i++)
                {
                    if (_registeredGroups[i] != UnregisteredGroup)
                    {
                        PDFListNumberGroup grp = _numbering.GetGroup(_registeredGroups[i]);
                        grp.Reset();
                    }
                }

                // remove the groups that are in the route but of a higher index

                while (_currRoute.Count > 0 && _currRoute[_currRoute.Count - 1] >= index)
                {
                    _currRoute.RemoveAt(_currRoute.Count - 1);
                }

                // put the index on the bottom od the route
                _currRoute.Add(index);

                // clear out the list numbering

                while (_numbering.HasCurrentGroup)
                {
                    _numbering.PopGroup();
                }



                // and build it back

                foreach (int exist in _currRoute)
                {
                    string grpname  = _registeredGroups[exist];
                    Style  grpstyle = _registeredStyles[exist];
                    _numbering.PushGroup(grpname, grpstyle);
                }

                // get the full number style value

                string value = _numbering.Increment();


                //and return the value

                return(value);
            }