回复 1楼menghuanyunxia的帖子
问题我已经重现了,正在调查中,有结果反馈给你。
测试代码:
- private void openExcelToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var fileName = "D:\\" + "test.xml";
- SpreadChart chart1 = this.fpSpread1.ActiveSheet.AddChart(0, 0, typeof(FarPoint.Win.Chart.XYLineSeries), 300, 300, 0, 0);
- using (var xmlTextWriter = new System.Xml.XmlTextWriter(fileName, Encoding.Unicode))
- {
- chart1.Serialize(xmlTextWriter);
- }
- }
- private void clearToolStripMenuItem_Click(object sender, EventArgs e)
- {
- this.fpSpread1.Sheets[0].Charts.Clear();
- var fileName = "D:\\" + "test.xml";
- XmlDocument doc = new XmlDocument();
- doc.Load(fileName);
- using (var xmlNodeReader = new XmlNodeReader(doc))
- {
- SpreadChart shape = new SpreadChart();
- var result = shape.Deserialize(xmlNodeReader);//无法还原为保存的Chart
- this.fpSpread1.ActiveSheet.Charts.Add(shape);
- }
- }
复制代码 |