Beispiel #1
0
        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();
        }
Beispiel #2
0
        protected void InsertItems(IList items, Model.Info_tmp_xls tmpXlsItem)
        {
            Miles.ReoGrid.ReportTemplate reportTemplate = new Miles.ReoGrid.ReportTemplate();
            reportTemplate.TemplateStream  = new MemoryStream(tmpXlsItem.Tmp_Body);
            reportTemplate.InitColumnCount = (int)tmpXlsItem.Column_Count;
            reportTemplate.InitRowCount    = (int)tmpXlsItem.Row_Count;
            reportTemplate.Bind(null, null);

            int itemStartRow    = (int)tmpXls.Item_Start_Row;
            int itemStartColumn = (int)tmpXls.Item_Start_Column;
            int itemGroupCount  = (int)tmpXls.Item_Row_Count;

            Dictionary <string, Model.Tb_tmp_xls_map> dicMap = new Dictionary <string, Model.Tb_tmp_xls_map>();

            foreach (var v in tmpXlsItem.VarMaps)
            {
                dicMap.Add(v.Var_Text, v);
            }
            InsertItems(items, new XlsItemGroup(reportTemplate.GetAllMergedCells(), itemGroupCount, dicMap), itemStartRow, itemStartColumn);
        }