Пример #1
0
 /// <summary>
 /// 插入一行数据
 /// </summary>
 /// <param name="row">待插入的数据行</param>
 /// <param name="CStyle">数据行统一单元格样式</param>
 public void InsertCellRow(CellRow row, CellStyle CStyle = null)
 {
     for (int i = row.LeftIndex; i <= row.RightIndex; i++)
     {
         SCell scell = new SCell();
         scell.CStyle = CStyle ?? new CellStyle();
         scell.Y      = i;
         scell.X      = row.RowIndex;
         if (row.Is_Pic)
         {
             scell.Image_Ms = (MemoryStream)(object)row.Obj_List[i - row.LeftIndex];
         }
         else
         {
             scell.Txt_Obj = (object)row.Obj_List[i - row.LeftIndex];
         }
         this.SCells.Add(scell);
     }
 }
Пример #2
0
 /// <summary>
 /// 插入一列数据
 /// </summary>
 /// <param name="rowlist">待插入数据列列表</param>
 /// <param name="CStyle">数据列统一单元格样式</param>
 public void InsertCellColm(CellColm clom, CellStyle CStyle = null)
 {
     for (int i = clom.TopIndex; i <= clom.ButtomIndex; i++)
     {
         SCell scell = new SCell();
         scell.CStyle = CStyle ?? new CellStyle();
         scell.Y      = clom.ColmIndex;
         scell.X      = i;
         if (clom.Is_Pic)
         {
             scell.Image_Ms = (MemoryStream)(object)clom.Obj_List[i - clom.TopIndex];
         }
         else
         {
             scell.Txt_Obj = (object)clom.Obj_List[i - clom.TopIndex];
         }
         this.SCells.Add(scell);
     }
 }
Пример #3
0
 /// <summary>
 /// 插入标题
 /// </summary>
 /// <param name="Inner_objlist">标题填充内容List</param>
 /// <param name="Style">标题单元格样式</param>
 /// <param name="TitleType">标题类型 1列标题 2行标题</param>
 /// <param name="FillModel">(0,0)单元格填充模式</param>
 public void InsertTitle(IList <object> Inner_objlist, CellStyle Style = null, TitleType TitleType = TitleType.列标题, FillModel FillModel = FillModel.空出第一个单元格)
 {
     if (FillModel == FillModel.没有标题)
     {
         return;
     }
     for (int i = 0; i < Inner_objlist.Count; i++)
     {
         SCell scell = new SCell
         {
             CStyle  = Style ?? new CellStyle(),
             Txt_Obj = Inner_objlist[i]
         };
         if (TitleType == ExcelFormat.TitleType.列标题)
         {
             if (FillModel == FillModel.列标题填充)
             {
                 scell.Y = i;
             }
             else
             {
                 scell.Y = i + 1;
             }
             this.SCells.Add(scell);
         }
         else if (TitleType == ExcelFormat.TitleType.行标题)
         {
             if (FillModel == FillModel.行标题填充)
             {
                 scell.X = i;
             }
             else
             {
                 scell.X = i + 1;
             }
             this.SCells.Add(scell);
         }
     }
 }