Exemple #1
0
        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.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
            try
            {
                base.GHTActiveSubTest = GHTSubTest1;
                base.GHTSubTestAddResult(myStyle.GridLines.ToString());
                Table1.ApplyStyle(myStyle);

                myStyle.CellSpacing   = 0;
                base.GHTActiveSubTest = GHTSubTest2;
                base.GHTSubTestAddResult(myStyle.GridLines.ToString());
                Table2.ApplyStyle(myStyle);

                myStyle.CellSpacing   = 9;
                base.GHTActiveSubTest = GHTSubTest3;
                base.GHTSubTestAddResult(myStyle.GridLines.ToString());
                Table3.ApplyStyle(myStyle);
            }

            catch (Exception ex)
            {
                base.GHTSubTestUnexpectedExceptionCaught(ex);
            }
            base.GHTSubTestEnd();
            base.GHTTestEnd();
        }
 public override string GetDesignTimeHtml()
 {
     var style = new TableStyle();
     var table = new Table();
     var component = Component as DeluxeSearch;
     var writer = new StringWriter();
     var html = new HtmlTextWriter(writer);
     if (null != component)
     {
         if (component.Categories.Count > 0)
         {
             foreach (var item in component.Categories)
             {
                 var cell = new TableCell();
                 var row = new TableRow();
                 cell.Text = string.Format("{0}:{1}", item.DataTextField, item.DataSourceID);
                 row.Cells.Add(cell);
                 table.Rows.Add(row);
             }
         }
         else
         {
             var cell = new TableCell();
             var row = new TableRow();
             cell.Text = component.ID;
             row.Cells.Add(cell);
             table.Rows.Add(row);
         }
         table.ApplyStyle(style);              
         table.RenderControl(html);
     }
     return writer.ToString();
 }
		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.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
			try 
			{
				base.GHTActiveSubTest = GHTSubTest1;
				base.GHTSubTestAddResult(myStyle.GridLines.ToString());
				Table1.ApplyStyle(myStyle);

				myStyle.CellSpacing = 0;
				base.GHTActiveSubTest = GHTSubTest2;
				base.GHTSubTestAddResult(myStyle.GridLines.ToString());
				Table2.ApplyStyle(myStyle);

				myStyle.CellSpacing = 9;
				base.GHTActiveSubTest = GHTSubTest3;
				base.GHTSubTestAddResult(myStyle.GridLines.ToString());
				Table3.ApplyStyle(myStyle);
			}

			catch (Exception ex) 
			{
				base.GHTSubTestUnexpectedExceptionCaught(ex);
			}
			base.GHTSubTestEnd();
			base.GHTTestEnd();
		}
        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
                };
        }
            /// <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;
                }
            }
        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.TableStyle tableStyle = new System.Web.UI.WebControls.TableStyle();
            tableStyle.CopyFrom(Table2.ControlStyle);
            Table1.ApplyStyle(tableStyle);

            base.GHTTestEnd();
        }
		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.TableStyle tableStyle = new System.Web.UI.WebControls.TableStyle();
			tableStyle.CopyFrom(Table2.ControlStyle);
			Table1.ApplyStyle(tableStyle);

			base.GHTTestEnd();
		}
		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.TableStyle myStyle = new TableStyle();

			myStyle = (TableStyle)Table1.ControlStyle;
			myStyle.Reset();
			Table1.Rows[0].Cells[0].ApplyStyle(myStyle);
			base.GHTTestEnd();
		}
 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);
 }
Exemple #10
0
		private void Page_Load(object sender, System.EventArgs e) 
		{
			//Put user code to initialize the page here
			base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
			try 
			{
				base.GHTSubTestBegin("TableStyle_ctor");
				System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();

				base.GHTSubTestAddResult("is (object = null)? " + ((myStyle == null) ? "True" : "False"));
			}
			catch (Exception ex) 
			{
				base.GHTSubTestUnexpectedExceptionCaught(ex);
			}
			base.GHTSubTestEnd();
			base.GHTTestEnd();
		}
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Put user code to initialize the page here
            base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
            try
            {
                base.GHTSubTestBegin("TableStyle_ctor");
                System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();

                base.GHTSubTestAddResult("is (object = null)? " + ((myStyle == null) ? "True" : "False"));
            }
            catch (Exception ex)
            {
                base.GHTSubTestUnexpectedExceptionCaught(ex);
            }
            base.GHTSubTestEnd();
            base.GHTTestEnd();
        }
 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,
     };
 }
		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.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
			try 
			{
				myStyle.HorizontalAlign = HorizontalAlign.Center;
				base.GHTActiveSubTest = GHTSubTest1;
				base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
				Table1.ApplyStyle(myStyle);

				myStyle.HorizontalAlign = HorizontalAlign.Justify;
				base.GHTActiveSubTest = GHTSubTest2;
				base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
				Table2.ApplyStyle(myStyle);

				myStyle.HorizontalAlign = HorizontalAlign.Left;
				base.GHTActiveSubTest = GHTSubTest3;
				base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
				Table3.ApplyStyle(myStyle);

				myStyle.HorizontalAlign = HorizontalAlign.NotSet;
				base.GHTActiveSubTest = GHTSubTest4;
				base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
				Table4.ApplyStyle(myStyle);

				myStyle.HorizontalAlign = HorizontalAlign.Right;
				base.GHTActiveSubTest = GHTSubTest5;
				base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
				Table5.ApplyStyle(myStyle);
			}
			catch (Exception ex) 
			{
				base.GHTSubTestUnexpectedExceptionCaught(ex);
			}
			base.GHTSubTestEnd();
			base.GHTTestEnd();
		}
Exemple #14
0
        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.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
            try
            {
                myStyle.HorizontalAlign = HorizontalAlign.Center;
                base.GHTActiveSubTest   = GHTSubTest1;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table1.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.Justify;
                base.GHTActiveSubTest   = GHTSubTest2;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table2.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.Left;
                base.GHTActiveSubTest   = GHTSubTest3;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table3.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.NotSet;
                base.GHTActiveSubTest   = GHTSubTest4;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table4.ApplyStyle(myStyle);

                myStyle.HorizontalAlign = HorizontalAlign.Right;
                base.GHTActiveSubTest   = GHTSubTest5;
                base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString());
                Table5.ApplyStyle(myStyle);
            }
            catch (Exception ex)
            {
                base.GHTSubTestUnexpectedExceptionCaught(ex);
            }
            base.GHTSubTestEnd();
            base.GHTTestEnd();
        }
        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.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
            try
            {
                base.GHTSubTestBegin("TableStyle - BackImageUrl");
                base.GHTActiveSubTest.Controls.Add(Table1);

                myStyle.BackImageUrl = "c:\\NoSuchImage.blabla";
                base.GHTSubTestAddResult(myStyle.BackImageUrl.ToString());
                Table1.ApplyStyle(myStyle);
            }

            catch (Exception ex)
            {
                base.GHTSubTestUnexpectedExceptionCaught(ex);
            }
            base.GHTSubTestEnd();
            base.GHTTestEnd();
        }
        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;
            }
        }
Exemple #17
0
        /// <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;
            }
        }
        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;
             }
        }
		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.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle();
			try 
			{
				base.GHTSubTestBegin("TableStyle - BackImageUrl");
				base.GHTActiveSubTest.Controls.Add(Table1);

				myStyle.BackImageUrl = "c:\\NoSuchImage.blabla";
				base.GHTSubTestAddResult(myStyle.BackImageUrl.ToString());
				Table1.ApplyStyle(myStyle);
			}

			catch (Exception ex) 
			{
				base.GHTSubTestUnexpectedExceptionCaught(ex);
			}
			base.GHTSubTestEnd();
			base.GHTTestEnd();


		}
Exemple #20
0
        public ExcelResult(IList rows, string fileName, string[] headers, Type resourceSource, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle)
        {
            Rows = rows;
            ResourceSource = resourceSource;
            _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;
            }
        }
		protected override Style CreateControlStyle ()
		{
			TableStyle style = new TableStyle (ViewState);
			style.GridLines = GridLines.Both;
			style.CellSpacing = 0;
			return style;
		}
Exemple #22
0
		public void HorizontalAlign_Invalid ()
		{
			TableStyle ts = new TableStyle ();
			ts.HorizontalAlign = (HorizontalAlign)Int32.MinValue;
		}
Exemple #23
0
		public void GridLines_Invalid ()
		{
			TableStyle ts = new TableStyle ();
			ts.GridLines = (GridLines)Int32.MinValue;
		}
Exemple #24
0
        /// <internalonly/>
        /// <devdoc>
        ///    <para>A protected method. Creates a table control style.</para>
        /// </devdoc>
        protected override Style CreateControlStyle() {
            TableStyle controlStyle = new TableStyle();

            // initialize defaults that are different from TableStyle
            controlStyle.CellSpacing = 0;
            controlStyle.CellPadding = 0;

            return controlStyle;
        }
 /// <summary>
 /// Overridden. Creates the control style object.
 /// </summary>
 /// <returns></returns>
 protected override Style CreateControlStyle()
 {
     TableStyle style = new TableStyle();
     style.CssClass = "barcodeTable";
     style.BorderStyle = BorderStyle.None;
     style.BorderWidth = new Unit(0);
     style.CellPadding = 10;
     style.CellSpacing = 0;
     return style;
 }
Exemple #26
0
		public void AddAttributesToRender_Null_WebControl ()
		{
			TableStyle ts = new TableStyle ();
			ts.AddAttributesToRender (null, new Table ());
			// no exception
		}
Exemple #27
0
		private TableStyle GetTableStyle ()
		{
			TableStyle ts = new TableStyle ();
			ts.BackImageUrl = imageUrl;
			ts.CellPadding = 1;
			ts.CellSpacing = 2;
			ts.GridLines = GridLines.Both;
			ts.HorizontalAlign = HorizontalAlign.Justify;
			return ts;
		}
Exemple #28
0
		protected override Style CreateControlStyle ()
		{
			// not kept (directly) in the DataList ViewState
			TableStyle tableStyle = new TableStyle ();
			tableStyle.CellSpacing = 0;
			return tableStyle;
		}
Exemple #29
0
		protected override Style CreateControlStyle ()
		{
			TableStyle style = new TableStyle ();
			style.CellPadding = 0;
			style.CellSpacing = 0;
			return style;
		}
		override void Render (HtmlTextWriter writer)
		{
			TableStyle ts = new TableStyle ();
			ts.CellSpacing = CellSpacing;
			ts.CellPadding = CellPadding;
			ts.BorderWidth = 1;
			if (ControlStyleCreated)
				ts.CopyFrom (ControlStyle);
			if (ShowGridLines)
				ts.GridLines = GridLines.Both;
			ts.AddAttributesToRender (writer);
			writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID);
			writer.RenderBeginTag (HtmlTextWriterTag.Table);

#if NET_2_0
			if (Caption != "")
				WriteCaption (writer);
#endif

			if (ShowTitle)
				WriteTitle (writer);

			if (ShowDayHeader)
				WriteDayHeader (writer);

			WriteDays (writer);

			writer.RenderEndTag ();
		}
Exemple #31
0
		public void BackImageUrl ()
		{
			TableStyle ts = new TableStyle ();
			ts.BackImageUrl = "test 1.jpg";
			StringWriter sw = new StringWriter ();
			sw.NewLine = "\n";
			HtmlTextWriter htw = new HtmlTextWriter (sw);
			ts.AddAttributesToRender (htw);
			htw.RenderBeginTag ("tagName");
			string res = htw.InnerWriter.ToString ();
			string expected = "<tagName style=\"background-image:url(";
			expected += "test%201.jpg";
			expected += ");\">\n";
			Assert.AreEqual (expected, res);
		}
Exemple #32
0
		public void MergeWith ()
		{
			TableStyle ts = new TableStyle ();
			ts.BackImageUrl = imageUrl + "1";
			ts.CellPadding = 2;
			ts.CellSpacing = 3;
			ts.GridLines = GridLines.Horizontal;
			ts.HorizontalAlign = HorizontalAlign.Left;

			ts.MergeWith (GetTableStyle ());

			Assert.AreEqual (imageUrl + "1", ts.BackImageUrl, "BackImageUrl");
			Assert.AreEqual (2, ts.CellPadding, "CellPadding");
			Assert.AreEqual (3, ts.CellSpacing, "CellSpacing");
			Assert.AreEqual (GridLines.Horizontal, ts.GridLines, "GridLines");
			Assert.AreEqual (HorizontalAlign.Left, ts.HorizontalAlign, "HorizontalAlign");
		}
Exemple #33
0
		public void CopyFrom ()
		{
			TableStyle ts = new TableStyle ();
			ts.BackImageUrl = imageUrl + "1";
			ts.CellPadding = 2;
			ts.CellSpacing = 3;
			ts.GridLines = GridLines.Horizontal;
			ts.HorizontalAlign = HorizontalAlign.Left;

			ts.CopyFrom (GetTableStyle ());
			CheckTableStyle (ts);
		}
Exemple #34
0
		public void CopyFrom_IsEmpty ()
		{
			TestTableStyle c = new TestTableStyle ();
			TableStyle s = new TableStyle ();

			
			s.BorderWidth = Unit.Empty;
			c.CopyFrom (s);
			Assert.IsTrue (c.Empty, "A1");
			
			s.GridLines = GridLines.Both;
			c.CopyFrom (s);
			Assert.IsFalse (c.Empty, "A2");
		}
Exemple #35
0
		private void CheckTableStyle (TableStyle ts)
		{
			Assert.AreEqual (imageUrl, ts.BackImageUrl, "BackImageUrl");
			Assert.AreEqual (1, ts.CellPadding, "CellPadding");
			Assert.AreEqual (2, ts.CellSpacing, "CellSpacing");
			Assert.AreEqual (GridLines.Both, ts.GridLines, "GridLines");
			Assert.AreEqual (HorizontalAlign.Justify, ts.HorizontalAlign, "HorizontalAlign");
		}