Exemplo n.º 1
0
        public void LoadFromDataView(CellAddress beginAddress, ExcelTableStyles tableStyle, DataView dv, CreatingDataCellAction <DataRowView> creatingDataCellAction)
        {
            dv.NullCheck <ArgumentNullException>("数据源不能为空!");

            TableDescription tbDesp = SpreadSheetAttributeHelper.GetTableDescription(dv.Table);

            tbDesp.BeginAddress = beginAddress;

            if (tableStyle == ExcelTableStyles.None && tbDesp.TableName.IsNullOrEmpty())
            {
                this.LoadFromDataView(tbDesp, dv, creatingDataCellAction);
            }
            else
            {
                tbDesp.TableStyle = tableStyle;
                Table table;

                if (this.Tables.TryGetTable(tbDesp.TableName, out table) == false)
                {
                    table = new Table(this, tbDesp);
                    this.Tables.Add(table);
                }

                table.FillData(dv, tbDesp, creatingDataCellAction);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///  逐行获取Table数据
 /// </summary>
 /// <typeparam name="T">待转换对象</typeparam>
 /// <param name="exportRow">导出行方法</param>
 /// <param name="upCount">验证正确条数</param>
 /// <param name="stopMode">验证出错是处理方式</param>
 /// <returns>返回所有错误日制</returns>
 public string ForEachTableRows <T>(ExportTableRow <T> exportRow, out int upCount, ValidationErrorStopMode stopMode = ValidationErrorStopMode.Continue)
 {
     return(this.ForEachTableRows(SpreadSheetAttributeHelper.GetTableDescription <T>(), new SpreadGetTableCollectionParams <T>(exportRow, stopMode), out upCount));
 }
Exemplo n.º 3
0
 public void LoadFromCollection <T>(IEnumerable <T> collection, CreatingDataCellAction <T> creatingDataCellAction)
 {
     this.LoadFromCollection <T>(collection, SpreadSheetAttributeHelper.GetTableDescription <T>(), creatingDataCellAction);
 }
Exemplo n.º 4
0
 public string GetCollectionFromTable <T, TCollection>(TCollection collection, SpreadGetTableCollectionParams <T> param) where TCollection : ICollection <T>
 {
     return(this.GetCollectionFromTable <T, TCollection>(collection, SpreadSheetAttributeHelper.GetTableDescription <T>(), param));
 }
Exemplo n.º 5
0
 public void LoadFromCollection <T>(IEnumerable <T> collection)
 {
     this.LoadFromCollection <T>(collection, SpreadSheetAttributeHelper.GetTableDescription <T>(), null);
 }