示例#1
0
        public ReportDefinition( )
        {
            this.ReportHeaderDefinition = new ReportHeaderDefinition();
            this.ReportHeaderDefinition.ReportTitle.TextStyle.FontSize = default_font_size;

            this.ReportFooterDefinition = new ReportFooterDefinition();

            this.Table     = new SimpleTable();
            this.TextStyle = new TextStyle();
        }
示例#2
0
        public ReportDefinition( )
        {
            this.ReportHeaderDefinition = new ReportHeaderDefinition();
            this.ReportHeaderDefinition.ReportTitle.TextStyle.FontSize = default_font_size;

            this.ReportFooterDefinition = new ReportFooterDefinition();

            this.Table = new SimpleTable();
            this.TextStyle = new TextStyle();



        }
示例#3
0
        public static void WriteX(this XmlWriter x, SimpleTable table)
        {
            while (table.ColumnStyles.Count < table.DataTable.Columns.Count)
            {
                var tcs = new TableColumnStyle();
                table.ColumnStyles.Add(tcs);
            }

            x.WriteStartTable();

            if (table.TableStyle.CellSpacing.HasValue)
            {
                x.WriteAttributeString("CellSpacing", table.TableStyle.CellSpacing.Value.ToString());
            }



            x.WriteStartTableColumns();
            int colindex = 0;

            foreach (System.Data.DataColumn col in table.DataTable.Columns)
            {
                x.WriteStartTableColumn();
                double width     = table.TableStyle.DefaultColumnWidth;
                var    col_style = table.ColumnStyles[colindex];
                if (col_style.Width > 0)
                {
                    width = col_style.Width;
                }

                x.WriteAttributeString("Width", width.ToString());
                x.WriteEndTableColumn();
                colindex++;
            }
            x.WriteEndTableColumns();

            x.WriteStartTableRowGroup();
            x.WriteAttributeString("FontWeight", "Bold");

            x.WriteStartTableRow();
            x.WriteTextStyleAttributes(table.HeaderTextStyle);

            colindex = 0;
            foreach (System.Data.DataColumn col in table.DataTable.Columns)
            {
                var col_caption = col.Caption ?? col.ColumnName;
                x.WriteStartTableCell();
                var col_style = table.ColumnStyles[colindex];


                x.WriteStartElement("Paragraph");
                x.WriteAttributeString("TextAlignment", col_style.HorzontalAlignment.ToString());
                x.WriteString(col_caption);
                x.WriteEndParagraph();


                x.WriteEndTableCell();

                colindex++;
            }
            x.WriteEndTableRow();
            x.WriteEndTableRowGroup();
            x.WriteStartTableRowGroup();
            x.WriteTextStyleAttributes(table.DetailTextStyle);

            foreach (System.Data.DataRow row in table.DataTable.Rows)
            {
                x.WriteStartTableRow();
                for (int i = 0; i < table.DataTable.Columns.Count; i++)
                {
                    var col_obj_val  = row[i];
                    var col_obj_type = col_obj_val.GetType();

                    var col_obj_val_str = col_obj_val.ToString();

                    x.WriteStartTableCell();

                    x.WriteAttributeString("BorderBrush", "Red");
                    x.WriteAttributeString("BorderThickness", "1");


                    var col_style = table.ColumnStyles[i];
                    x.WriteTextStyleAttributes(col_style.DetailTextStyle);

                    x.WriteStartElement("Paragraph");
                    x.WriteAttributeString("TextAlignment", col_style.HorzontalAlignment.ToString());
                    x.WriteString(col_obj_val_str);
                    x.WriteEndParagraph();

                    x.WriteEndTableCell();
                }
                x.WriteEndTableRow();
            }
            x.WriteEndTableRowGroup();
            x.WriteEndTable();
        }
示例#4
0
文件: X.cs 项目: saveenr/saveenr
        public static void WriteX(this XmlWriter x, SimpleTable table)
        {

            while (table.ColumnStyles.Count<table.DataTable.Columns.Count)
            {
                var tcs = new TableColumnStyle();
                table.ColumnStyles.Add(tcs);
            }

            x.WriteStartTable();

            if (table.TableStyle.CellSpacing.HasValue)
            {
                x.WriteAttributeString("CellSpacing", table.TableStyle.CellSpacing.Value.ToString());
                
            }



            x.WriteStartTableColumns();
            int colindex = 0;
            foreach (System.Data.DataColumn col in table.DataTable.Columns)
            {
                x.WriteStartTableColumn();
                double width = table.TableStyle.DefaultColumnWidth;
                var col_style = table.ColumnStyles[colindex];
                if (col_style.Width>0)
                {
                    width = col_style.Width;
                }

                x.WriteAttributeString("Width", width.ToString());
                x.WriteEndTableColumn();
                colindex++;
            }
            x.WriteEndTableColumns();

            x.WriteStartTableRowGroup();
            x.WriteAttributeString("FontWeight", "Bold");

            x.WriteStartTableRow();
            x.WriteTextStyleAttributes(table.HeaderTextStyle);

            colindex = 0;
            foreach (System.Data.DataColumn col in table.DataTable.Columns)
            {
                var col_caption = col.Caption ?? col.ColumnName;
                x.WriteStartTableCell();
                var col_style = table.ColumnStyles[colindex];


                x.WriteStartElement("Paragraph");
                x.WriteAttributeString("TextAlignment", col_style.HorzontalAlignment.ToString());
                x.WriteString(col_caption);
                x.WriteEndParagraph();


                x.WriteEndTableCell();

                colindex++;


            }
            x.WriteEndTableRow();
            x.WriteEndTableRowGroup();
            x.WriteStartTableRowGroup();
            x.WriteTextStyleAttributes(table.DetailTextStyle);
            
            foreach (System.Data.DataRow row in table.DataTable.Rows)
            {
                x.WriteStartTableRow();
                for (int i = 0; i < table.DataTable.Columns.Count; i++)
                {
                    var col_obj_val = row[i];
                    var col_obj_type = col_obj_val.GetType();

                    var col_obj_val_str = col_obj_val.ToString();

                    x.WriteStartTableCell();

                    x.WriteAttributeString("BorderBrush", "Red");
                    x.WriteAttributeString("BorderThickness", "1");


                    var col_style = table.ColumnStyles[i];
                    x.WriteTextStyleAttributes(col_style.DetailTextStyle);

                    x.WriteStartElement("Paragraph");
                    x.WriteAttributeString("TextAlignment",col_style.HorzontalAlignment.ToString());
                    x.WriteString(col_obj_val_str);
                    x.WriteEndParagraph();

                    x.WriteEndTableCell();


                }
                x.WriteEndTableRow();

            }
            x.WriteEndTableRowGroup();
            x.WriteEndTable();
        }