Spread for ASP.NET 9.0 Product Documentation
Equals Method (NamedStyle)
Example 


Determines whether another object is a reference to this object.
Overload List
OverloadDescription
EqualsDetermines whether another object is a reference to this object.  
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.
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();
}
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 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional

See Also

Reference

NamedStyle Class
NamedStyle Members

 

 


Copyright © GrapeCity, inc. All rights reserved.