コード例 #1
0
ファイル: CxRowExport.cs プロジェクト: carlosmagno5150/CxSpec
        private void ExportTemplate <T>(IXLWorksheet sheet, T model) where T : CxFile
        {
            var props = model.GetType().GetProperties();

            for (int i = 0; i < props.Count(); i++)
            {
                var spec = (CxColSpec)props[i].GetCustomAttributes(true)
                           .Where(x => x is CxColSpec)?.FirstOrDefault();

                if (spec == null)
                {
                    continue;
                }

                var rownum = 1;
                var colrow = spec.Col + rownum;
                var title  = spec.Title == "" ? props[i].Name : spec.Title;
                var size   = GetSizeFromPropValue(model, props[i].Name, title);
                sheet.CLSetColHeader(colrow, title, size, spec.TipoColumn);
            }
        }