protected void ReplaceVar(object dataSource, bool isClearEmptyVar = true) { List <unvell.ReoGrid.Cell> cells = this.GetAllMergedCells(); foreach (unvell.ReoGrid.Cell cellFrom in cells) { string varText = FindVarString(cellFrom.DisplayText); if (varText != null) { Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance; Model.Tb_tmp_xls_map map = dicVarMap.ContainsKey(varText) ? dicVarMap[varText] : null; if (map != null) { string dataField = map.Field_Name; object value = memberAccessor.GetValue(dataSource, dataField); unvell.ReoGrid.Cell cell = this.Sheet.Cells[cellFrom.Row, cellFrom.Column]; if (value != null) { SetCellFormatData(cell, value, map.Field_Format); } else { if (isClearEmptyVar) { SetCellFormatData(cell, "", null); } } } } } }
public override void SetDataBind(object dataSource) { if (IsSetBind && !string.IsNullOrEmpty(this.BindDataField)) { Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance; object valueId = memberAccessor.GetValue(dataSource, this.BindDataField); object valueDetail = memberAccessor.GetValue(dataSource, this.BindDataText); if (!Cache.LogicCache.DicPlaces.ContainsKey((long)valueId)) { return; } Model.Info_place_info placeInfo = Cache.LogicCache.DicPlaces[(long)valueId]; placeInfo.DetailAdress = valueDetail.ToString(); this.SetDataSource(placeInfo); } }
protected void InsertItems(IList items, XlsItemGroup xlsItemGroup, int itemStartRow, int itemStartCol) { int itemCount = items.Count; int rowCount = xlsItemGroup.RowCount; if (itemCount > 1) { this.Sheet.InsertRows(itemStartRow + rowCount, rowCount * (itemCount - 1)); } //按照插入行行的合并情况,循环列合并,新增加的行的列 for (int row = 1; row < itemCount; row++) { SetItemGroupMergedCell(this.Sheet, itemStartRow + row * rowCount, itemStartCol, xlsItemGroup.CellsTmp); } for (int row = 0; row < itemCount; row++) { object dataSource = items[row]; foreach (unvell.ReoGrid.Cell cellFrom in xlsItemGroup.CellsTmp) { int realRow = itemStartRow + row * rowCount; unvell.ReoGrid.Cell cell = this.Sheet.Cells[cellFrom.Row + realRow, cellFrom.Column + itemStartCol]; string varText = FindVarString(cellFrom.DisplayText); if (varText != null) { Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance; Model.Tb_tmp_xls_map map = xlsItemGroup.DicVarMap.ContainsKey(varText) ? xlsItemGroup.DicVarMap[varText] : null; if (map != null) { string dataField = map.Field_Name; object value = memberAccessor.GetValue(dataSource, dataField); if (value != null) { //根据格式来设置单元格值 SetCellFormatData(cell, value, map.Field_Format); this.Sheet.AutoFitRowHeight(realRow); } } } else { cell.Data = cellFrom.Data; } } } }
public virtual void SetDataBind(object dataSource) { if (IsSetBind && !string.IsNullOrEmpty(this.BindDataField)) { Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance; object value = memberAccessor.GetValue(dataSource, this.BindDataField); string jsonStr = value == null ? null : value.ToString(); Bu_GutterInfo gutterInfo = new Bu_GutterInfo(); if (!string.IsNullOrEmpty(jsonStr)) { gutterInfo = (Bu_GutterInfo)Newtonsoft.Json.JsonConvert.DeserializeObject(jsonStr, typeof(Bu_GutterInfo)); } this.SetDataSource(gutterInfo); } }
public virtual void SetDataBind(object dataSource) { if (IsSetBind && !string.IsNullOrEmpty(this.BindDataField)) { Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance; object value = memberAccessor.GetValue(dataSource, this.BindDataField); string jsonStr = value == null ? null : value.ToString(); Bu_ItemSpec itemSpec = new Bu_ItemSpec(); if (!string.IsNullOrEmpty(jsonStr)) { itemSpec = (Bu_ItemSpec)JsonConvert.DeserializeObject(jsonStr, typeof(Bu_ItemSpec)); } this.ItemSpec = itemSpec; } }
private void SetItemCellValue(Info_link_bill_tent item, int rowOffset, bool isEmpty = false) { List <unvell.ReoGrid.Cell> cellsTmp = reportTmpItem.GetAllMergedCells(); foreach (var v in cellsTmp) { int realRow = v.Row + rowOffset; string varText = Report.ReportTemplateBase.FindVarString(v.DisplayText); if (varText != null) { if (isEmpty) { Cell cell = reportTmpBillInfo.Sheet.Cells[realRow, v.Column]; cell.Data = ""; } else { Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance; string dataField = varText.Substring(2, varText.Length - 3); object value = memberAccessor.GetValue(item, dataField); if (value != null) { Cell cell = reportTmpBillInfo.Sheet.Cells[realRow, v.Column]; Miles.ReoGrid.ReportTemplate.SetCellValue(cell, value, item); } } } else { Cell cell = reportTmpBillInfo.Sheet.Cells[realRow, v.Column]; cell.Data = v.Data;// value; } } if (!isEmpty) { reportTmpBillInfo.AutoFitAllColumnWidth(); reportTmpBillInfo.AutoFitAllRowHeight(); } reportTmpBillInfo.SetGridBorderLine(); }