Determines whether another object is a reference to this object.
Syntax
Visual Basic (Declaration) | |
---|
Public Overrides Function Equals( _
ByVal o As Object _
) As Boolean |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As NamedStyle
Dim o As Object
Dim value As Boolean
value = instance.Equals(o) |
Parameters
- o
- String containing the style to compare
Return Value
true if the specified object is a reference to this object;
false otherwise
Example
This example creates a new DefaultSheetStyleModel object, two NamedStyle's and a NamedStyleCollection object. The NamedStyle's are added to the spreadsheets NamedStyles and added to the NamedStyleCollection, which in turn is used for the DefaultSheetStyleModel's NamedStyles. In the click event of two buttons the NamedStyle can be Deserialized or Serialized. A list box returns whether the second style is a reference of the first.
C# | Copy Code |
---|
FarPoint.Web.Spread.NamedStylefpstyle=newFarPoint.Web.Spread.NamedStyle();
FarPoint.Web.Spread.NamedStylefpstyle1=newFarPoint.Web.Spread.NamedStyle();
FarPoint.Web.Spread.NamedStyleCollectionnsc=newFarPoint.Web.Spread.NamedStyleCollection();
FarPoint.Web.Spread.Model.DefaultSheetStyleModelmodel=newFarPoint.Web.Spread.Model.DefaultSheetStyleModel(10,10);
privatevoidPage_Load(objectsender,System.EventArgse)
{
if(IsPostBack)
{
return;
}
boolb;
objecto;
FpSpread1.NamedStyles.Add(fpstyle);
FpSpread1.NamedStyles.Add(fpstyle1);
nsc=FpSpread1.NamedStyles;
fpstyle.BackColor=Color.Yellow;
o=fpstyle;
fpstyle1=fpstyle;
b=fpstyle1.Equals(o);
model.SetDirectInfo(0,0,fpstyle);
model.NamedStyles=nsc;
FpSpread1.ActiveSheetView.ColumnCount=model.ColumnCount;
FpSpread1.ActiveSheetView.RowCount=model.RowCount;
FpSpread1.ActiveSheetView.StyleModel=model;
ListBox1.Items.Add(b.ToString());
}
privatevoidButton1_Click(objectsender,System.EventArgse)
{
System.Xml.XmlDocumentdoc=newSystem.Xml.XmlDocument();
doc.Load("C:\\Temp\\mymodel.xml");
System.Xml.XmlNodeReaderr=newSystem.Xml.XmlNodeReader(doc);
fpstyle.Deserialize(r);
r.Close();
}
privatevoidButton2_Click(objectsender,System.EventArgse)
{
System.Xml.XmlTextWriterw=newSystem.Xml.XmlTextWriter("C:\\Temp\\mymodel.xml",System.Text.Encoding.UTF8);
w.Formatting=System.Xml.Formatting.Indented;
w.WriteStartElement("ol");
w.WriteStartElement("li");
fpstyle.Serialize(w);
w.WriteEndElement();
w.Flush();
w.Close();
} |
Visual Basic | Copy Code |
---|
DimfpstyleAsNewFarPoint.Web.Spread.NamedStyle()
Dimfpstyle1AsNewFarPoint.Web.Spread.NamedStyle()
DimnscAsNewFarPoint.Web.Spread.NamedStyleCollection()
DimmodelAsNewFarPoint.Web.Spread.Model.DefaultSheetStyleModel(10,10)
PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
If(IsPostBack)Then
Return
EndIf
DimbAsBoolean
DimoAsObject
FpSpread1.NamedStyles.Add(fpstyle)
FpSpread1.NamedStyles.Add(fpstyle1)
nsc=FpSpread1.NamedStyles
fpstyle.BackColor=Color.Yellow
o=fpstyle
fpstyle1=fpstyle
b=fpstyle1.Equals(o)
model.SetDirectInfo(0,0,fpstyle)
model.NamedStyles=nsc
FpSpread1.ActiveSheetView.ColumnCount=model.ColumnCount
FpSpread1.ActiveSheetView.RowCount=model.RowCount
FpSpread1.ActiveSheetView.StyleModel=model
EndSub
PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
DimdocAsNewSystem.Xml.XmlDocument()
doc.Load("C:\Temp\mymodel.xml")
DimrAsNewSystem.Xml.XmlNodeReader(doc)
fpstyle.Deserialize(r)
r.Close()
EndSub
PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.Click
DimwAsNewSystem.Xml.XmlTextWriter("C:\Temp\mymodel.xml",System.Text.Encoding.UTF8)
w.Formatting=System.Xml.Formatting.Indented
w.WriteStartElement("ol")
w.WriteStartElement("li")
fpstyle.Serialize(w)
w.WriteEndElement()
w.Flush()
w.Close()
EndSub |
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also