Exemple #1
0
        public void addPages(string sLabelFormat, List <LabelInfo> lItems)
        {
            lFormats = new List <LabelEntryBase>();

            string[] sTextList = sLabelFormat.Split(new char[] { '~' });
            foreach (string sItem in sTextList)
            {
                if (sItem.Length > 0)
                {
                    lFormats.Add(LabelEntryBase.create(sItem));
                }
            }

            if (lItems == null)
            {
                LabelPage lpNew = new LabelPage();
                lpNew.populate(lFormats);
                lPages.Add(lpNew);
            }
            else
            {
                int iMaxRepeat = getMaxRepeat(lFormats);

                if (lItems.Count() == 0 || iMaxRepeat == 0)
                {
                    return;
                }

                int iCount = (int)Math.Ceiling((decimal)lItems.Count() / iMaxRepeat);

                for (int iX = 0; iX < iCount; iX++)
                {
                    LabelPage lpNew = new LabelPage();
                    lpNew.populate(lFormats, lItems, iX * iMaxRepeat);
                    lPages.Add(lpNew);
                }
            }
        }