Spread ASP.NET 17
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / Appearance Class / Copy Method
Appearance object to be copied
Example


In This Topic
    Copy Method (Appearance)
    In This Topic
    Copies the properties of the specified Appearance object to the current object.
    Syntax
    'Declaration
     
    
    Public Overridable Sub Copy( _
       ByVal obj As Object _
    ) 
    'Usage
     
    
    Dim instance As Appearance
    Dim obj As Object
     
    instance.Copy(obj)
    public virtual void Copy( 
       object obj
    )

    Parameters

    obj
    Appearance object to be copied
    Example
    This example creates two Appearance objects and a Cell object. Several properties are set for the first Appearance object, and they are subsequently copied to the second instance. The properties are then applied from the second Appearance object to the Cell objects corresponding properties. The BackColor property of the Appearance object is then queried to see if it has been defined, and the result is returned to a text box.
    FarPoint.Web.Spread.Appearance appr = new FarPoint.Web.Spread.Appearance();
    FarPoint.Web.Spread.Appearance appr1 = new FarPoint.Web.Spread.Appearance();
    FarPoint.Web.Spread.Cell acell;
    appr.BackColor=Color.Red;
    appr.ForeColor=Color.White;
    appr.Font.Bold=True;
    appr.HorizontalAlign=HorizontalAlign.Right;
    appr.VerticalAlign=VerticalAlign.Top;
    appr1.Copy(appr);
    acell=FpSpread1.Cells[0,0];
    acell.BackColor=appr1.BackColor;
    acell.ForeColor=appr1.ForeColor;
    acell.Font.Bold=appr1.Font.Bold;
    acell.HorizontalAlign=appr1.HorizontalAlign;
    acell.VerticalAlign=appr1.VerticalAlign;
    FpSpread1.ActiveSheetView.SetValue(0,0,"AppearanceTest");
    FpSpread1.Columns[0].Width=150;
    FpSpread1.Rows[0].Height=60;
    bool bl;
    bl=appr.IsDefined(FarPoint.Web.Spread.AppearanceProperty.BackColor);
    TextBox1.Text=Convert.ToString(bl);
    Dim appr As New FarPoint.Web.Spread.Appearance()
    Dim appr1 As New FarPoint.Web.Spread.Appearance()
    appr.BackColor=Color.Red
    appr.ForeColor=Color.White
    appr.Font.Bold=True
    appr.HorizontalAlign=HorizontalAlign.Right
    appr.VerticalAlign=VerticalAlign.Top
    appr1.Copy(appr)
    Dim acell As FarPoint.Web.Spread.Cell
    acell=FpSpread1.Cells(0,0)
    acell.BackColor=appr1.BackColor
    acell.ForeColor=appr1.ForeColor
    acell.Font.Bold=appr1.Font.Bold
    acell.HorizontalAlign=appr1.HorizontalAlign
    acell.VerticalAlign=appr1.VerticalAlign
    FpSpread1.ActiveSheetView.SetValue(0,0,"AppearanceTest")
    FpSpread1.Columns(0).Width=150
    FpSpread1.Rows(0).Height=60
    Dim prop As FarPoint.Web.Spread.AppearanceProperty
    Dim bl As Boolean
    bl=appr.IsDefined(prop.BackColor)
    TextBox1.Text=bl
    See Also