示例#1
0
        public static String GetBulletText(ListTables listTables,
                                           Paragraph paragraph, int listId)
        {
            ListLevel listLevel = listTables.GetLevel(listId,
                                                      paragraph.GetIlvl());

            if (listLevel.GetNumberText() == null)
            {
                return(string.Empty);
            }

            StringBuilder bulletBuffer = new StringBuilder();

            char[] xst = listLevel.GetNumberText().ToCharArray();
            foreach (char element in xst)
            {
                if (element < 9)//todo:review_antony
                {
                    ListLevel numLevel = listTables.GetLevel(listId, element);

                    int num = numLevel.GetStartAt();
                    bulletBuffer.Append(NumberFormatter.GetNumber(num,
                                                                  listLevel.GetNumberFormat()));

                    if (numLevel == listLevel)
                    {
                        numLevel.SetStartAt(numLevel.GetStartAt() + 1);
                    }
                }
                else
                {
                    bulletBuffer.Append(element);
                }
            }

            byte follow = listLevel.GetTypeOfCharFollowingTheNumber();

            switch (follow)
            {
            case 0:
                bulletBuffer.Append("\t");
                break;

            case 1:
                bulletBuffer.Append(" ");
                break;

            default:
                break;
            }

            return(bulletBuffer.ToString());
        }
示例#2
0
 internal ListEntry(PAPX papx, Range parent, ListTables tables)
     : base(papx, parent)
 {
     if (tables != null)
     {
         ListFormatOverride override1 = tables.GetOverride(_props.GetIlfo());
         _overrideLevel = override1.GetOverrideLevel(_props.GetIlvl());
         _level         = tables.GetLevel(override1.GetLsid(), _props.GetIlvl());
     }
     else
     {
         //log.log(POILogger.WARN, "No ListTables found for ListEntry - document probably partly corrupt, and you may experience problems");
     }
 }
示例#3
0
文件: Range.cs 项目: zzy092/npoi
        /**
         * Inserts a list into the beginning of this range.
         *
         * @param props
         *            The properties of the list entry. All list entries are
         *            paragraphs.
         * @param listID
         *            The id of the list that Contains the properties.
         * @param level
         *            The indentation level of the list.
         * @param styleIndex
         *            The base style's index in the stylesheet.
         * @return The empty ListEntry that is now part of the document.
         */
        public ListEntry InsertAfter(ParagraphProperties props, int listID, int level, int styleIndex)
        {
            ListTables lt = _doc.GetListTables();

            if (lt.GetLevel(listID, level) == null)
            {
                throw new InvalidDataException("The specified list and level do not exist");
            }
            int ilfo = lt.GetOverrideIndexFromListID(listID);

            props.SetIlfo(ilfo);
            props.SetIlvl((byte)level);

            return((ListEntry)InsertAfter(props, styleIndex));
        }