Пример #1
0
        protected void CreateGlobalHeaderRow(UReportPage page)
        {
            CRow r = (CRow)rowdef["GLB_HEADER_LEVEL0"];

            CRow   nr   = r.Clone();
            String info = String.Format("{0} ({1})", CUtil.DateTimeToDateStringTime(DateTime.Now), OnixWebServiceAPI.GetLastUserLogin());

            nr.FillColumnsText(info, "Page " + CurrentPage);
            ConstructUIRow(page, nr);

            AvailableSpace = AvailableSpace - nr.GetHeight();

            String rpid = rptparam.GetFieldValue("REPORT_ID");

            r = (CRow)rowdef["GLB_HEADER_LEVEL1"];
            r.FillColumnsText(reportObj.Optional);
            ConstructUIRow(page, r);

            AvailableSpace = AvailableSpace - r.GetHeight();

            String header = createReportParamHeader();

            if (!header.Equals(""))
            {
                CRow paramRow = (CRow)rowdef["GLB_HEADER_PARAM"];
                paramRow.FillColumnsText(header);
                ConstructUIRow(page, paramRow);

                AvailableSpace = AvailableSpace - paramRow.GetHeight();
            }
        }
Пример #2
0
        private Tuple <int, int, int> getStartEndLen(CColumn col, CRow baseRow, int start)
        {
            System.Windows.GridLength width = col.GetWidth();
            double w = width.Value;

            int    last = baseRow.GetColumnCount() - 1;
            double sum  = 0.00;

            int cnt = 0;
            int i;

            for (i = start; i < last; i++)
            {
                double colWidth = baseRow.GetColumn(i).GetWidth().Value;
                sum = sum + colWidth;

                cnt++;
                if (sum >= w)
                {
                    break;
                }
            }

            return(Tuple.Create(start, i, cnt));
        }
Пример #3
0
        private void populateCacheRow(CTable cacheRow, CMergeCellParam mergedParam, CRow row, CColumn col)
        {
            String    text    = col.GetText().Text;
            ArrayList columns = cacheRow.GetChildArray("COLUMNS");

            CTable cacheColumn = new CTable("");

            columns.Add(cacheColumn);

            int fromCell = mergedParam.FromCell + 1;
            int toCell   = mergedParam.ToCell + 1;
            int span     = mergedParam.CellMergedCount;

            cacheColumn.SetFieldValue("TEXT", text);
            cacheColumn.SetFieldValue("FROM_CELL", fromCell.ToString());
            cacheColumn.SetFieldValue("TO_CELL", toCell.ToString());
            cacheColumn.SetFieldValue("CELL_SPAN", span.ToString());

            Boolean isBold = row.GetFontWeight().Equals(System.Windows.FontWeights.Bold);
            String  dt     = col.getDataType();

            System.Windows.HorizontalAlignment align = col.GetHorizontalAlignment();

            cacheColumn.SetFieldValue("IS_BOLD", isBold.ToString());
            cacheColumn.SetFieldValue("TYPE", dt);
            cacheColumn.SetFieldValue("TEXT_ALIGN", align.ToString());
            cacheColumn.SetFieldValue("IS_MERGED", mergedParam.IsMerged.ToString());
        }
Пример #4
0
        protected double addNewDataRow(Hashtable rowdef, CReportDataProcessingProperty rpp, String key, String format, int row, CTable data)
        {
            CRow d0  = (CRow)rowdef[key];
            CRow d00 = d0.Clone();

            ArrayList temps00 = getColumnDataTexts(format, row + 1, data);

            d00.FillColumnsText(temps00);
            rpp.AddReportRow(d00);

            return(d00.GetHeight());
        }
Пример #5
0
        public void CalculateMergeCellRange(String baseTemplate)
        {
            CRow row = (CRow)rowTemplate[baseTemplate];

            foreach (String key in rowTemplate.Keys)
            {
                CRow      r            = (CRow)rowTemplate[key];
                ArrayList mergedParams = createCellMergeParam(row, r);

                rowMergedParam.Add(key, mergedParams);
            }
        }
Пример #6
0
        protected double addNewFooterRow(Hashtable rowdef, CReportDataProcessingProperty rpp, String key, String format, string caption, ArrayList totals)
        {
            CRow ft  = (CRow)rowdef[key];
            CRow ftr = ft.Clone();

            ArrayList subTotals = displayTotalTexts(format, totals, 1, caption);

            ftr.FillColumnsText(subTotals);

            rpp.AddReportRow(ftr);

            return(ftr.GetHeight());
        }
Пример #7
0
        public CRow Clone()
        {
            CRow nrw = new CRow(nm, h, column);

            foreach (CColumn c in columns)
            {
                CColumn o = c.Clone();
                nrw.AddColumn(o);
            }

            nrw.SetMargin(this.margin);
            nrw.SetFont(this.ff, this.fs, this.fz, this.fw);

            return(nrw);
        }
Пример #8
0
        public void AddRowTemplate(CRow row)
        {
            String nm = row.GetName();

            rowTemplate[nm] = row;

            int colCount = row.GetColumnCount();

            if (colCount > maxColumn)
            {
                maxColumn = colCount;
            }

            cacheObj.SetFieldValue("MAX_COLUMN", maxColumn.ToString());
        }
Пример #9
0
        public void AddRow(CRow row)
        {
            String name = row.GetName();

            if (name.Contains("GLB_HEADER_LEVEL0"))
            {
                currentPage++;
            }

            if ((currentPage > 1) && name.Contains("HEADER"))
            {
                //Skip header if page greater than 1
                return;
            }

            currentRow++;

            ArrayList arr = (ArrayList)rowMergedParam[name];

            if (arr == null)
            {
                return;
            }

            int    cnt     = row.GetColumnCount();
            String rowText = String.Format("{0}", name);

            CTable cacheRow = new CTable("ROW");

            cacheRow.SetFieldValue("ROW_ID", currentRow.ToString());
            cacheRow.SetFieldValue("ROW_TYPE", row.GetName());
            cacheRow.AddChildArray("COLUMNS", new ArrayList());
            cacheRows.Add(cacheRow);

            for (int i = 0; i < cnt; i++)
            {
                CMergeCellParam mergedParam = (CMergeCellParam)arr[i];
                CColumn         col         = row.GetColumn(i);
                String          text        = col.GetText().Text;

                populateCacheRow(cacheRow, mergedParam, row, col);
            }

            String dummy = rowText;
        }
Пример #10
0
        private void CreateDefaultHeader()
        {
            String    nm        = "";
            Thickness defMargin = new Thickness(3, 1, 3, 1);

            CColumn c0_0 = new CColumn(new Thickness(0, 0, 0, 0), new GridLength(50, GridUnitType.Star));

            c0_0.SetHorizontalAlignment(HorizontalAlignment.Left);

            CColumn c0_1 = new CColumn(new Thickness(0, 0, 0, 0), new GridLength(50, GridUnitType.Star));

            c0_1.SetHorizontalAlignment(HorizontalAlignment.Right);

            nm = "GLB_HEADER_LEVEL0";

            CRow h0 = new CRow(nm, 20, 2, defMargin);

            h0.SetFont(null, FontStyles.Normal, 10, FontWeights.Normal);
            h0.AddColumn(c0_0);
            h0.AddColumn(c0_1);
            rowdef[nm] = h0;

            CColumn c1_0 = new CColumn(new Thickness(0, 0, 0, 0), new GridLength(100, GridUnitType.Star));

            nm = "GLB_HEADER_LEVEL1";
            CRow h1 = new CRow(nm, 30, 1, defMargin);

            h1.SetFont(null, FontStyles.Normal, 0, FontWeights.Bold);
            h1.AddColumn(c1_0);
            rowdef[nm] = h1;

            CColumn c1_2 = new CColumn(new Thickness(0, 0, 0, 0), new GridLength(100, GridUnitType.Star));

            nm = "GLB_HEADER_PARAM";
            CRow h2 = new CRow(nm, 30, 1, defMargin);

            h2.SetFont(null, FontStyles.Normal, 0, FontWeights.Bold);
            h2.AddColumn(c1_2);
            rowdef[nm] = h2;
        }
Пример #11
0
        protected void configRow(String group, CRow row, String rowType)
        {
            ArrayList arr = (ArrayList)reportConfigHash[group];
            int       cnt = arr.Count;
            int       i   = 0;

            foreach (CReportColConfig cc in arr)
            {
                Thickness tck = new Thickness(0.5, 0.5, 0, 0.5);
                if (i == cnt - 1)
                {
                    tck = new Thickness(0.5, 0.5, 0.5, 0.5);
                }

                HorizontalAlignment al = HorizontalAlignment.Left;
                if (rowType.Equals("H"))
                {
                    al = cc.HeaderAlighment;
                }
                else if (rowType.Equals("B"))
                {
                    al = cc.BodyAlighment;
                }
                else if (rowType.Equals("F"))
                {
                    al = cc.FooterAlighment;
                }

                CColumn c = new CColumn(tck, new GridLength(cc.ColumnWidth, GridUnitType.Star));
                c.SetHorizontalAlignment(al);
                c.SetDataType(cc.DataType);

                row.AddColumn(c);

                i++;
            }

            excel.AddRowTemplate(row);
        }
Пример #12
0
        private ArrayList createCellMergeParam(CRow baseRow, CRow row)
        {
            ArrayList arr = new ArrayList();

            int colCnt = row.GetColumnCount();
            int end    = -1;

            for (int i = 0; i < colCnt; i++)
            {
                CColumn col             = row.GetColumn(i);
                Tuple <int, int, int> t = getStartEndLen(col, baseRow, end + 1);

                int start  = t.Item1;
                int length = t.Item3;
                end = t.Item2;

                CMergeCellParam cell = new CMergeCellParam(start, end, length);
                arr.Add(cell);
            }

            return(arr);
        }
Пример #13
0
 public void AddReportRow(CRow r)
 {
     rows.Add(r);
 }
Пример #14
0
        protected void ConstructUIRow(UReportPage page, CRow row)
        {
            double maxh = 0.00;
            Grid   grd  = new Grid();

            RowDefinition rd = new RowDefinition();

            rd.Height = new GridLength(row.GetHeight());
            grd.RowDefinitions.Add(rd);

            if (excel != null)
            {
                excel.AddRow(row);
            }

            int cnt = row.GetColumnCount();

            for (int i = 0; i < cnt; i++)
            {
                CColumn          clm = row.GetColumn(i);
                ColumnDefinition cd  = new ColumnDefinition();
                cd.Width = clm.GetWidth();
                grd.ColumnDefinitions.Add(cd);
            }

            for (int i = 0; i < cnt; i++)
            {
                CColumn clm = row.GetColumn(i);

                Border bd = new Border();

                bd.BorderBrush         = clm.GetBorderColor();
                bd.BorderThickness     = clm.GetBorderThickness();
                bd.VerticalAlignment   = VerticalAlignment.Stretch;
                bd.HorizontalAlignment = HorizontalAlignment.Stretch;

                TextBlock tblk = new TextBlock();

                tblk.Margin = row.GetMargin();
                tblk.HorizontalAlignment = clm.GetHorizontalAlignment();
                tblk.VerticalAlignment   = clm.GetVertocalAlignment();
                tblk.Text = clm.GetText().Text;
                //tblk.TextWrapping = TextWrapping.Wrap;
                if (row.GetFontFamily() != null)
                {
                    tblk.FontFamily = row.GetFontFamily();
                }
                tblk.FontWeight = row.GetFontWeight();
                tblk.FontStyle  = row.GetFontStyle();
                if (row.GetFontSize() > 0)
                {
                    tblk.FontSize = row.GetFontSize();
                }

                if (tblk.ActualHeight > maxh)
                {
                    maxh = tblk.ActualHeight;
                }

                bd.Child = tblk;

                Grid.SetColumn(bd, i);
                grd.Children.Add(bd);
            }

            page.AddRowPannel(grd);
        }