当前位置: 首页>>代码示例>>C#>>正文


C# WebControls.TableItemStyle类代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TableItemStyle的典型用法代码示例。如果您正苦于以下问题:C# TableItemStyle类的具体用法?C# TableItemStyle怎么用?C# TableItemStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TableItemStyle类属于System.Web.UI.WebControls命名空间,在下文中一共展示了TableItemStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExcelFileResult

            /// <summary>
            /// constructor
            /// </summary>
            /// <param name="dt">To export DataTable</param>
            /// <param name="tableStyle">Styling for entire table</param>
            /// <param name="headerStyle">Styling for header</param>
            /// <param name="itemStyle">Styling for the individual cells</param>
            public ExcelFileResult(DataTable dt, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle)
                : base("application/ms-excel")
            {
                this.dt = dt;
                Title = "Attendance Report ";
                Footer = "Powered By: Hasib, IT Department";
                TitleExportDate = "Export Date: {0}";
                this.tableStyle = tableStyle;
                this.headerStyle = headerStyle;
                this.itemStyle = itemStyle;
                ExcelPackage EXPackage = new ExcelPackage();

                // provide defaults
                if (this.tableStyle == null)
                {
                    this.tableStyle = new TableStyle();
                    this.tableStyle.BorderStyle = BorderStyle.Solid;
                    this.tableStyle.BorderColor = Color.Black;
                    this.tableStyle.BorderWidth = Unit.Parse("2px");
                    //this.tableStyle.BackColor = Color.LightGray;
                    this.tableStyle.BackColor = Color.Azure;
                    //this.tableStyle.BackImageUrl = Path.GetFullPath("D:/HOP/BOK.jpg");
                    //exPackage.Workbook.Properties.Author = "Hasib";
                    //exPackage.Workbook.Properties.Comments = "HopLunIT";
                    //exPackage.Workbook.Properties.Title = "HopLun (Bangladesh) Ltd. Reports";
                }
                if (this.headerStyle == null)
                {
                    this.headerStyle = new TableItemStyle();
                    this.headerStyle.BackColor = Color.LightGray;
                }
            }
开发者ID:cipher4uall,项目名称:hop-attendance,代码行数:39,代码来源:Excelimport.cs

示例2: ExcelResult

        public ExcelResult( 
            IQueryable rows, string fileName, 
            string[] headers,
            TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle)
        {
            //_Mapping = mapping;
            _Rows = rows;
            _FileName = fileName;
            _Headers = headers;
            _TableStyle = tableStyle;
            _HeaderStyle = headerStyle;
            _ItemStyle = itemStyle;

            // provide defaults
            if (_TableStyle == null)
                _TableStyle = new TableStyle();

            if (_HeaderStyle == null)
                _HeaderStyle = new TableItemStyle
                {
                    BackColor = Color.LightGray,
                };

            if (_ItemStyle == null)
                _ItemStyle = new TableItemStyle
                {
                    BorderStyle = BorderStyle.Solid,
                    BorderWidth = new Unit("1px"),
                    BorderColor = Color.LightGray
                };
        }
开发者ID:Logrythmik,项目名称:Logrythmik.Mvc,代码行数:31,代码来源:ExcelResult.cs

示例3: save

        private void save(DataTable dt,string filename)
        {
            DataGrid excel = new DataGrid();
            System.Web.UI.WebControls.TableItemStyle AlternatingStyle = new TableItemStyle();
            System.Web.UI.WebControls.TableItemStyle headerStyle = new TableItemStyle();
            System.Web.UI.WebControls.TableItemStyle itemStyle = new TableItemStyle();
            AlternatingStyle.BackColor = System.Drawing.Color.LightGray;
            headerStyle.BackColor = System.Drawing.Color.LightGray;
            headerStyle.Font.Bold = true;
            headerStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
            itemStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center; ;

            excel.AlternatingItemStyle.MergeWith(AlternatingStyle);
            excel.HeaderStyle.MergeWith(headerStyle);
            excel.ItemStyle.MergeWith(itemStyle);
            excel.GridLines = GridLines.Both;
            excel.HeaderStyle.Font.Bold = true;
            DataSet ds = new DataSet();
            ds.Tables.Add(dt);
            excel.DataSource = ds;   //输出DataTable的内容
            excel.DataBind();

            System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
            excel.RenderControl(oHtmlTextWriter);

            Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8) + ".xls");
            Response.ContentType = "application/ms-excel";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            Response.Write(oHtmlTextWriter.InnerWriter.ToString());
            Response.End();
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:32,代码来源:ExportXLS.aspx.cs

示例4: Page_Load

		private void Page_Load(object sender, System.EventArgs e) 
		{
			//Put user code to initialize the page here
			base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
			System.Web.UI.WebControls.TableItemStyle myStyle = new System.Web.UI.WebControls.TableItemStyle();
			try 
			{
				base.GHTSubTestBegin("TableItemStyle - Wrap");
				base.GHTActiveSubTest.Controls.Add(Table1);

				myStyle.Wrap = false;
				base.GHTSubTestAddResult(myStyle.Wrap.ToString());
				Table1.Rows[0].Cells[0].ApplyStyle(myStyle);
				Table1.Rows[0].ApplyStyle(myStyle);

				myStyle.Wrap = true;
				base.GHTSubTestAddResult(myStyle.Wrap.ToString());
				Table1.Rows[0].Cells[1].ApplyStyle(myStyle);
				Table1.Rows[1].ApplyStyle(myStyle);
			}
			catch (Exception ex) 
			{
				base.GHTSubTestUnexpectedExceptionCaught(ex);
			}
			base.GHTSubTestEnd();
			base.GHTTestEnd();
		}
开发者ID:nobled,项目名称:mono,代码行数:27,代码来源:TableItemStyle_Wrap.aspx.cs

示例5: New

        /// <summary>
        /// Creates and returns a new <see cref="System.Web.UI.WebControls.TableItemStyle"/> with 
        /// the specified CSS Class.
        /// </summary>
        /// <param name="cssclass">The CSS Class name which is set as the CSS Class of the 
        /// newly created <see cref="System.Web.UI.WebControls.TableItemStyle"/>.</param>
        /// <returns>
        /// The newly created <see cref="System.Web.UI.WebControls.TableItemStyle"/>.
        /// </returns>
        public static TableItemStyle New(string cssclass)
        {
            TableItemStyle style = new TableItemStyle();

            style.CssClass = cssclass;

            return style;
        }
开发者ID:NLADP,项目名称:ADF,代码行数:17,代码来源:StyleHelper.cs

示例6: Page_Load

		private void Page_Load(object sender, System.EventArgs e) 
		{
			//Put user code to initialize the page here
			base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
			System.Web.UI.WebControls.TableItemStyle tableStyle = new System.Web.UI.WebControls.TableItemStyle();
			tableStyle.CopyFrom(Table2.Rows[0].Cells[0].ControlStyle);
			Table1.Rows[0].Cells[0].ApplyStyle(tableStyle);

			tableStyle.CopyFrom(Table2.Rows[1].ControlStyle);
			Table1.Rows[1].ApplyStyle(tableStyle);

			base.GHTTestEnd();
		}
开发者ID:nobled,项目名称:mono,代码行数:13,代码来源:TableItemStyle_CopyFrom_S.aspx.cs

示例7: Excel

 public static ActionResult Excel(
     this Controller controller, 
     DataContext dataContext,
     IQueryable rows, 
     string fileName, 
     string[] headers, 
     TableStyle tableStyle, 
     TableItemStyle headerStyle,
     TableItemStyle itemStyle
 )
 {
     return new ExcelResult(dataContext, rows, fileName, headers, tableStyle, headerStyle, itemStyle);
 }
开发者ID:veritasfx,项目名称:MVCDTS,代码行数:13,代码来源:ExcelControllerExtensions.cs

示例8: DoInitialization

        static private void DoInitialization()
        {
            mcStyle = new TableItemStyle();
            mcStyle.HorizontalAlign = HorizontalAlign.Center;
            mcStyle.BackColor = teColors.eeRowBg;
            mcStyle.BorderColor = Color.Black;
            mcStyle.BorderStyle = BorderStyle.None;
            mcStyle.BorderWidth = 0;
            mcStyle.ForeColor = teColors.eeText;

            mcStyle.Font.Name = "Arial";
            mcStyle.Font.Size = 10;
            mcStyle.HorizontalAlign = HorizontalAlign.Left;
        }
开发者ID:Aoki2,项目名称:kzmod_web_stats,代码行数:14,代码来源:tcGridViewFactory.cs

示例9: Export

        public static string Export(System.Data.DataTable dt, string fileName)
        {
            System.Web.UI.Page page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page;

            StringWriter stringWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
            DataGrid dGrid = new DataGrid();

            TableItemStyle alternatingStyle = new TableItemStyle();
            TableItemStyle headerStyle = new TableItemStyle();
            TableItemStyle itemStyle = new TableItemStyle();

            alternatingStyle.BackColor = Color.LightGray;

            headerStyle.BackColor = Color.LightGray;
            headerStyle.Font.Bold = true;
            headerStyle.HorizontalAlign = HorizontalAlign.Center;

            itemStyle.HorizontalAlign = HorizontalAlign.Center;

            dGrid.GridLines = GridLines.Both;

            dGrid.HeaderStyle.MergeWith(headerStyle);
            dGrid.HeaderStyle.Font.Bold = true;

            dGrid.AlternatingItemStyle.MergeWith(alternatingStyle);
            dGrid.ItemStyle.MergeWith(itemStyle);

            dGrid.DataSource = dt.DefaultView;
            dGrid.DataBind();
            dGrid.RenderControl(htmlWriter);

            string filePath = Path.Combine(excelFullFolder, fileName + ext);
            if (System.IO.File.Exists(filePath))
            {
                System.IO.File.Delete(filePath);
            }
            StreamWriter sw = new StreamWriter(filePath, false, System.Text.Encoding.UTF8);
            sw.Write(stringWriter.ToString());
            sw.Close();

            int pos = page.Request.Url.ToString().LastIndexOf(page.Request.Path);

            string fileUrl = page.Request.Url.ToString().Substring(0, pos);
            fileUrl += page.Request.ApplicationPath + excelFolder.Replace("\\", "/") + fileName + ext;
            HttpContext.Current.Response.Redirect(fileUrl);

            return fileUrl;
        }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:49,代码来源:ExcelHelper.cs

示例10: Page_Load

		private void Page_Load(object sender, System.EventArgs e) 
		{
			//Put user code to initialize the page here

			base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
			System.Web.UI.WebControls.TableItemStyle myStyle = new System.Web.UI.WebControls.TableItemStyle();
				try 
				{
					base.GHTSubTestBegin("TableItemStyle - HorizontalAlign");
					base.GHTActiveSubTest.Controls.Add(Table1);

					myStyle.HorizontalAlign = HorizontalAlign.Center;
					base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
					Table1.Rows[0].Cells[0].ApplyStyle(myStyle);
					Table1.Rows[0].ApplyStyle(myStyle);

					myStyle.HorizontalAlign = HorizontalAlign.Justify;
					base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
					Table1.Rows[0].Cells[1].ApplyStyle(myStyle);
					Table1.Rows[1].ApplyStyle(myStyle);

					myStyle.HorizontalAlign = HorizontalAlign.Left;
					base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
					Table1.Rows[0].Cells[2].ApplyStyle(myStyle);
					Table1.Rows[2].ApplyStyle(myStyle);

					myStyle.HorizontalAlign = HorizontalAlign.NotSet;
					base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
					Table1.Rows[0].Cells[3].ApplyStyle(myStyle);
					Table1.Rows[3].ApplyStyle(myStyle);

					myStyle.HorizontalAlign = HorizontalAlign.Right;
					base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
					Table1.Rows[0].Cells[4].ApplyStyle(myStyle);
					Table1.Rows[4].ApplyStyle(myStyle);
				}
				catch (Exception ex) 
				{
					base.GHTSubTestUnexpectedExceptionCaught(ex);
				}
			base.GHTSubTestEnd();
			base.GHTTestEnd();
		}
开发者ID:nobled,项目名称:mono,代码行数:43,代码来源:TableItemStyle_HorizontalAlign.aspx.cs

示例11: Page_Load

		private void Page_Load(object sender, System.EventArgs e) 
		{
			//Put user code to initialize the page here
			// System.Web.UI.StateBag
			base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
			try 
			{
				base.GHTSubTestBegin("TableItemStyle_ctor_S");
				System.Web.UI.WebControls.TableItemStyle myStyle;
				myStyle = new System.Web.UI.WebControls.TableItemStyle(new System.Web.UI.StateBag(true));

				base.GHTSubTestAddResult("is (object = null)? " + ((myStyle == null) ? "True" : "False"));
			}
			catch (Exception ex) 
			{
				base.GHTSubTestUnexpectedExceptionCaught(ex);
			}
			base.GHTSubTestEnd();
			base.GHTTestEnd();
		}
开发者ID:nobled,项目名称:mono,代码行数:20,代码来源:TableItemStyle_ctor_S.aspx.cs

示例12: ExcelFeedGenerator

 public ExcelFeedGenerator()
 {
     _tableStyle = new TableStyle
     {
         BorderStyle = BorderStyle.Solid,
         BorderColor = Color.Black,
         BorderWidth = Unit.Parse("1px"),
     };
     _headerStyle = new TableItemStyle
     {
         VerticalAlign = VerticalAlign.Top,
         BackColor = Color.DimGray,
     };
     _itemStyle = new TableItemStyle
     {
         VerticalAlign = VerticalAlign.Top,
         BorderStyle = BorderStyle.Solid,
         BorderColor = Color.DimGray,
     };
 }
开发者ID:kirolosgerges,项目名称:Blog,代码行数:20,代码来源:ExcelFeedGenerator.cs

示例13: ExcelResult

        public ExcelResult(IQueryable rows, string fileName, Dictionary<string, string> headers, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle)
        {
            _rows = rows;
            _fileName = fileName;
            _headers = headers;
            _tableStyle = tableStyle;
            _headerStyle = headerStyle;
            _itemStyle = itemStyle;

            // provide defaults
            if (_tableStyle == null)
            {
                _tableStyle = new TableStyle();
                _tableStyle.BorderStyle = BorderStyle.Solid;
                _tableStyle.BorderColor = Color.Black;
                _tableStyle.BorderWidth = Unit.Parse("1px");
            }
            if (_headerStyle == null)
            {
                _headerStyle = new TableItemStyle();
                _headerStyle.BackColor = Color.LightGray;
            }
        }
开发者ID:jorik041,项目名称:lessons-asp-mvc,代码行数:23,代码来源:ExcelResult.cs

示例14: ExcelFileResult

        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="dt">Die zu exportierende DataTable</param>
        /// <param name="tableStyle">Styling für gesamgte Tabelle</param>
        /// <param name="headerStyle">Styling für Kopfzeile</param>
        /// <param name="itemStyle">Styling für die einzelnen Zellen</param>
        public ExcelFileResult(DataTable dt, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle)
            : base("application/ms-excel")
        {
            this.dt = dt;
            TitleExportDate = "Exportdatum: {0}";
            this.tableStyle = tableStyle;
            this.headerStyle = headerStyle;
            this.itemStyle = itemStyle;

            // provide defaults
            if (this.tableStyle == null)
            {
                this.tableStyle = new TableStyle();
                this.tableStyle.BorderStyle = BorderStyle.Solid;
                this.tableStyle.BorderColor = Color.Black;
                this.tableStyle.BorderWidth = Unit.Parse("2px");
            }
            if (this.headerStyle == null)
            {
                this.headerStyle = new TableItemStyle();
                this.headerStyle.BackColor = Color.LightGray;
            }
        }
开发者ID:rodinho,项目名称:DeSCo,代码行数:30,代码来源:ExcelFileResult.cs

示例15: ExcelResult

        public ExcelResult(DbContext dataContext, IQueryable rows, string fileName, string[] headers, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle)
        {
            _dataContext = dataContext;
             _rows = rows;
             _fileName = fileName;
             _headers = headers;
             _tableStyle = tableStyle;
             _headerStyle = headerStyle;
             _itemStyle = itemStyle;

             // provide defaults
             if (_tableStyle == null)
             {
                 _tableStyle = new TableStyle();
                 _tableStyle.BorderStyle = BorderStyle.Solid;
                 _tableStyle.BorderColor = Color.Black;
                 _tableStyle.BorderWidth = Unit.Parse("2px");
             }
             if (_headerStyle == null)
             {
                 _headerStyle = new TableItemStyle();
                 _headerStyle.BackColor = Color.LightGray;
             }
        }
开发者ID:rvazquezglez,项目名称:bitacoraip,代码行数:24,代码来源:ExcelResult.cs


注:本文中的System.Web.UI.WebControls.TableItemStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。