public void Merge([NotNull] XlsRowBuilder toRowBuilder)
 {
     foreach (var line in toRowBuilder.RowValues)
     {
         RowValues.Add(new RowValue(line.Name, line.Value));
     }
 }
        public static XlsRowBuilder GetAllProperties(object?o)
        {
            var rb = new XlsRowBuilder();

            if (o == null)
            {
                throw new LPGException("object was null");
            }
            var properties = o.GetType().GetProperties();

            foreach (PropertyInfo property in properties)
            {
                var shouldIgnoreAttribute = Attribute.IsDefined(property, typeof(RowBuilderIgnoreAttribute));
                if (shouldIgnoreAttribute)
                {
                    continue;
                }

                object?val = property.GetValue(o);
                if (o is List <string> mylist)
                {
                    val = string.Join(",", mylist);
                }

                rb.Add(property.Name, val);
            }

            return(rb);
        }
        public static RowCollection MakeRowCollectionFromObjects <T>([NotNull] List <T> objects, [NotNull] string name)
        {
            RowCollection rc = new RowCollection(name);

            foreach (var o in objects)
            {
                var rbc = XlsRowBuilder.GetAllProperties(o);
                rc.Add(rbc);
            }
            return(rc);
        }
 public void RunXlsDumperBasicTest()
 {
     using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
     {
         RowCollection rc = new RowCollection("mysheet");
         var           rb = XlsRowBuilder.Start("t1", "mytxt").Add("blub", 1).Add("blub2", 1);
         rc.Add(rb);
         var rb2 = XlsRowBuilder.Start("t1", "mytxt").Add("blub", 1).Add("blub5", 1);
         rc.Add(rb2);
         MyTst         mc  = new MyTst();
         RowCollection rc2 = new RowCollection("sheet2");
         var           rbc = XlsRowBuilder.GetAllProperties(mc);
         rc2.Add(rbc);
         XlsxDumper.WriteToXlsx(wd.Combine("t.xlsx"), rc, rc2);
     }
 }
 public void Add([NotNull] XlsRowBuilder rowBuilder)
 {
     Rows.Add(rowBuilder.GetRow());
 }
        public static XlsRowBuilder Start([NotNull] string name, object?content)
        {
            var rb = new XlsRowBuilder();

            return(rb.Add(name, content));
        }