public SheetEnumerator(SheetWriter writer) { _sheet = writer.Entity as Sheet; _writer = writer; _dynamicObject = writer._dynamicObject; _curIndex = -1; }
public DynamicAreaWriter(DynamicArea entity, BaseWriterContainer parent) : base(entity, parent) { _dynamicObject = new DynamicSource(entity.ProductRule); _dynamicObject.SetParam("RowIndex", p => p); _dynamicObject.SetParam("RowNum", p => p + 1); }
public void QueryStringMethod3() { var source = new DynamicSource().QueryString("a", new List<string>() { "Vorname" , "Nachname" , "Leiter.Vorname" }); var node = source.Query; var converter = new QNodeConverter(); var expression = converter.Convert(this.persons.AsQueryable(),node); var result = this.persons.AsQueryable().Execute(expression); }
public override void Draw() { var source = ItemsSource ?? DynamicSource?.Invoke(); if (source == null) { return; } foreach (var o in source) { ItemTemplate(o); } }
public SheetWriter(ISheet exSheet, Sheet sheet, BaseWriterContainer parent) : base(sheet, parent) { this._exSheet = exSheet; this.Entity = sheet;//(Sheet)sheet.Clone();//防止原始的Xml规则被修改[数据源未Clone] if (sheet.IsDynamic) { _dynamicObject = new DynamicSource(sheet.ProductRule, Entity.ProductRule.GetSource(sheet.SourceName)); _dynamicObject.SetParam("SheetNum", p => p + 1); _dynamicObject.SetParam("SheetIndex", p => p); _dynamicObject.DistinctFunc = (dt, index) => { return(parseExpression(sheet.NameRule, dt.Rows[index])); }; } }
public void Dispose() { _sheet = null; _dynamicObject = null; }
protected override Table CreateEntity() { BaseEntity container = _upperElement.CurrentEntity; ProductRule prodRule = container.ProductRule; Location tmpLocation = new Location(_data.GetAttribute("location")); _entity = new Table(prodRule, container, tmpLocation); string tmpStr = _data.GetAttribute("source"); if (!string.IsNullOrEmpty(tmpStr)) { _entity.SourceName = tmpStr; //只要不是动态解析的数据源,Source不能为空 if ((container is Sheet && !(container as Sheet).IsDynamic) || !DynamicSource.NeedDynamicParse(tmpStr)) { //_entity.Source = prodRule.RegistSource(tmpStr); prodRule.RegistSource(tmpStr); } } _entity.RowNumIndex = ParseUtil.ParseColumnIndex(_data.GetAttribute("rowNumIndex"), -1); _entity.CopyFill = ParseUtil.ParseBoolean(_data.GetAttribute("copyFill"), true); _entity.SumLocation = ParseUtil.ParseEnum <LocationPolicy>(_data.GetAttribute("sumLocation"), LocationPolicy.Undefined); _entity.SumOffset = ParseUtil.ParseInt(_data.GetAttribute("sumOffset"), _entity.SumLocation == LocationPolicy.Undefined || _entity.SumLocation == LocationPolicy.Absolute ? -1 : 0); _entity.AutoFitHeight = ParseUtil.ParseBoolean(_data.GetAttribute("autoFitHeight"), false); int groupLevel = ParseUtil.ParseInt(_data.GetAttribute("groupLevel"), 0); if (groupLevel > 0) { tmpStr = _data.GetAttribute("groupNumShow"); if (!string.IsNullOrEmpty(tmpStr)) { bool[] shows = new bool[groupLevel]; string[] bools = tmpStr.Split(','); for (int i = 0; i < bools.Length && i < shows.Length; i++) { if (bool.Parse(bools[i])) { shows[i] = true; } } _entity.SetGroup(shows); } } _entity.AdjustSumOffset(); #region Field重复出现的处理 List <Field> fieldlist = new List <Field>(); tmpStr = _data.GetAttribute("fields"); if (!string.IsNullOrEmpty(tmpStr)) { string[] fieldArray = tmpStr.Split(','); foreach (var fieldname in fieldArray) { fieldlist.Add(new Field(_entity, fieldname)); } } _entity.AddFields(fieldlist); //子结点 parseField(_upperElement.ProductRuleElement.QuerySubNodes("Field", _data)); #endregion Field重复出现的处理 // 行号处理 parseRowNum(_upperElement.ProductRuleElement.QuerySubNodes("RowNum", _data)); //区域计算:计算行号、字段的列位置,以及Table填充列范围 _entity.CalculateArea(); //汇总列:在确定字段位置之后处理 tmpStr = _data.GetAttribute("sumColumns"); if (!string.IsNullOrEmpty(tmpStr)) { string[] columns = tmpStr.Split(','); _entity.AddSumColumns(columns); } return(_entity); }