又发现不一个奇怪的问题,保存又打开后,那个fpSpread1_Change事件就无效了,咋回事?
- public partial class Form1 : Form
- {
- private MemoryStream myStream = new MemoryStream();
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- myStream = new MemoryStream();
- fpSpread1.Save(myStream, false );
- }
- private void button2_Click(object sender, EventArgs e)
- {
- byte[] data = myStream.GetBuffer(); //获得内存数据流的接口
- myStream.Position = 0; //需要把内存流指针修改为0
- fpSpread1.Open(myStream);
- }
- private void fpSpread1_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e)
- {
- }
- private void fpSpread1_Change(object sender, FarPoint.Win.Spread.ChangeEventArgs e)
- {
- if (e.Column == 1)
- {
- fpSpread1_Sheet1.Cells[e.Row, e.Column + 1].Formula = fpSpread1_Sheet1.Cells[e.Row, e.Column].Value.ToString();
- //fpSpread1_Sheet1.ColumnFooter.Cells[0, 2].Formula = "SUM(C1:C50)";
- }
- }
-
复制代码
StreamTest.rar
(66.17 KB, 下载次数: 3100)
|