回复 15楼darkelf的帖子
你好,
关于 CellType 的序列号方法参考例子,所有单元格类型均有 Serialize 方法:
- FarPoint.Win.Spread.CellType.CurrencyCellType curr = new FarPoint.Win.Spread.CellType.CurrencyCellType();
- curr.DecimalSeparator = ",";
- curr.DecimalPlaces = 3;
- fpSpread1.ActiveSheet.Cells[0, 0].CellType = curr;
- fpSpread1.ActiveSheet.Cells[0, 0].Value = 443.0908;
- string fileName;
- fileName = "..\\files\\mycurr.xml";
- System.IO.Stream stream;
- stream = System.IO.File.Open(fileName, System.IO.FileMode.Create);
- System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(stream, System.Text.Encoding.UTF8);
- writer.Formatting = System.Xml.Formatting.Indented; writer.Indentation = 2;
- writer.WriteStartDocument();
- writer.WriteStartElement("Currency");
- curr.Serialize(writer);
- writer.WriteEndElement();
- writer.WriteEndDocument();
- writer.Close();
复制代码
关于样式的序列化方法,请参考:
- FarPoint.Win.Spread.NamedStyle ns = new FarPoint.Win.Spread.NamedStyle();
- ns.BackColor = Color.Yellow;
- fpSpread1.ActiveSheet.DefaultStyle = ns;
- string fileName;
- fileName = "..\\files\\mystyle.xml";
- System.IO.Stream stream;
- stream = System.IO.File.Open(fileName, System.IO.FileMode.Create);
- System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(stream, System.Text.Encoding.UTF8);
- writer.Formatting = System.Xml.Formatting.Indented;
- writer.Indentation = 2;
- writer.WriteStartDocument();
- writer.WriteStartElement("Style");
- ns.Serialize(writer);
- writer.WriteEndElement();
- writer.WriteEndDocument();
- writer.Close();
复制代码 |