回复 4楼rkk的帖子
你好,
格式当前无法独立保存,只能独立保存数据。
保存到数据库可以先把 Spread 保存到流,在转化成 byte[] 存入数据库:
保存整个 Spread 对象:
- MemoryStream stream = new MemoryStream();
- fpSpread1.Sheets[0].Cells[0, 0].Text = "abc";
- fpSpread1.Save(stream, false);
- byte[] bts = new byte[stream.Length];
- stream.Read(bts, 0, (int)stream.Length);
- stream.Close();
复制代码
保存特定Sheet对象:
- MemoryStream stream = new MemoryStream();
- fpSpread1.Sheets[0].Cells[0, 0].Text = "abc";
- fpSpread1.Sheets[0].Save(stream, false);
- byte[] bts = new byte[stream.Length];
- stream.Read(bts, 0, (int)stream.Length);
- stream.Close();
复制代码 |