Exemplo n.º 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));
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }