Exemple #1
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));
        }
Exemple #2
0
        public CColumn Clone()
        {
            CColumn nc = new CColumn(txtClr, bdClr, thickness, valign, halign);

            nc.SetWidth(this.GetWidth());
            nc.SetDataType(this.getDataType());

            return(nc);
        }
Exemple #3
0
        public void FillColumnsText(ArrayList values)
        {
            int i = 0;

            foreach (String rc in values)
            {
                CColumn c        = (CColumn)columns[i];
                c.GetText().Text = rc;

                i++;
            }
        }
Exemple #4
0
        public void FillColumnsText(params String[] values)
        {
            int i = 0;

            foreach (String value in values)
            {
                CColumn c        = (CColumn)columns[i];
                c.GetText().Text = value;

                i++;
            }
        }
Exemple #5
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);
        }
Exemple #6
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;
        }
Exemple #7
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;
        }
Exemple #8
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);
        }
Exemple #9
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);
        }
Exemple #10
0
 public void AddColumn(CColumn c)
 {
     columns.Add(c);
 }
Exemple #11
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);
        }
Exemple #12
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());
        }