Example #1
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());
        }
Example #2
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);
        }