Exemplo n.º 1
0
        List <itemInfo> CloneBlock(itemInfo[] items, int pagenum)
        {
            List <itemInfo> ret = new List <itemInfo>();

            foreach (itemInfo item in items)
            {
                itemInfo new_item = (itemInfo)item.Clone();
                //new_item.top += offset;
                if (!Common.IsNullOrEmpty(new_item.Value))
                {
                    new_item.Value = new_item.Value.Replace("[#" + PAGENUMBER + "#]", pagenum.ToString());
                }
                ret.Add(new_item);
            }
            return(ret);
        }
Exemplo n.º 2
0
 public static int RepItemComparer(itemInfo inf1, itemInfo inf2)
 {
     if (inf1 is imgInfo && inf2 is textInfo)
     {
         return(1);
     }
     else if (inf2 is imgInfo && inf1 is textInfo)
     {
         return(-1);
     }
     else if (inf1 is checkInfo && inf2 is textInfo)
     {
         return(1);
     }
     else if (inf2 is checkInfo && inf1 is textInfo)
     {
         return(-1);
     }
     else if (inf1.top > inf2.top)
     {
         return(1);
     }
     else if (inf1.top < inf2.top)
     {
         return(-1);
     }
     else if (inf1.left > inf2.left)
     {
         return(1);
     }
     else if (inf1.left < inf2.left)
     {
         return(-1);
     }
     else
     {
         return(0);
     }
 }
Exemplo n.º 3
0
            public void Fill()
            {
                if (Values == null)
                {
                    return;
                }
                int   counter = 1;
                float offset  = 0;
                float delta   = TemplateItems[TemplateItems.Count - 1].top + TemplateItems[TemplateItems.Count - 1].height - TemplateItems[0].top;
                int   index   = Parent.IndexOf(TemplateItems[0]);

                foreach (object val in Values)
                {
                    if (val == null)
                    {
                        continue;
                    }
                    List <itemInfo> tmpls = new List <itemInfo>();
                    foreach (itemInfo tmpl in TemplateItems)
                    {
                        itemInfo new_tmpl = tmpl.Clone() as itemInfo;
                        new_tmpl.top += offset;
                        tmpls.Add(new_tmpl);
                    }
                    Parent.InsertRange(index, tmpls);
                    foreach (itemInfo tmpl in tmpls)
                    {
                        if (tmpl.Value != null && tmpl.Value.StartsWith("[#" + Name + "."))
                        {
                            if (tmpl.Value.StartsWith("[#" + Name + "." + ROWNUMBER))
                            {
                                tmpl.Value = counter.ToString();
                            }
                            else
                            {
                                string propname = Common.CreateFormatString(tmpl.Value.Replace(Name + ".", ""));
                                tmpl.Value = String.Format(Common.Formatter, propname, val);
                            }
                        }

                        //{
                        //    string[] pars = propname.Replace(Name + ".", "").Split(':');
                        //    object oval = null;
                        //    if (val is IPropValue)
                        //        oval = ((IPropValue)val).GetValue(pars[0]);
                        //    else
                        //        oval = ExtraRepDataInfo.GetValue(val, pars[0]);

                        //    string frmt = "";
                        //    for (int i = 1; i < pars.Length; i++)
                        //    {
                        //        frmt += ":" + pars[i];
                        //    }
                        //    if (oval == null)
                        //        tmpl.Value = "!" + pars[0] + "!";
                        //    else
                        //        tmpl.Value = (frmt == "") ? oval.ToString() : string.Format(Common.Formatter, @"{0" + frmt + @"}", oval);
                        //}
                    }
                    offset += delta;
                    counter++;
                }
                offset -= delta;
                Parent.RemoveRange(Parent.IndexOf(TemplateItems[0]), TemplateItems.Count);
                foreach (itemInfo rest in RestItems)
                {
                    rest.top += offset;
                }
            }