找回密码
 立即注册

QQ登录

只需一步,快速开始

byf

注册会员

11

主题

43

帖子

130

积分

注册会员

积分
130
byf
注册会员   /  发表于:2017-12-6 18:13  /   查看:3549  /  回复:3
导入excel代码:

  private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();

                openFileDialog.Filter = "Excel File (.xls,.xlsx)|*.xls; *.xlsx";

                openFileDialog.FilterIndex = 1;

                openFileDialog.Multiselect = false;

                DialogResult dResult = openFileDialog.ShowDialog();

                if (dResult == DialogResult.OK)
                {
                    System.IO.FileStream stream = new System.IO.FileStream(openFileDialog.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);

                    sp.gcSpreadSheet1.OpenExcel(stream);


                    stream.Close();

                    MessageBox.Show("导入成功");

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

导入前正常

导入后空白(excel文件并不是空白的)

test.rar

391.13 KB, 下载次数: 176

excel文件

devTest.rar

1.83 MB, 下载次数: 187

demo

3 个回复

倒序浏览
JeffryLI
葡萄城公司职员   /  发表于:2017-12-6 20:03:49
沙发
您用的这个开发控件是什么?是不是spread for winform的?
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
byf
注册会员   /  发表于:2017-12-7 09:10:50
板凳
JeffryLI 发表于 2017-12-6 20:03
您用的这个开发控件是什么?是不是spread for winform的?

WPF
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-12-7 09:25:49
地板
重复帖子,另一个帖子里处理
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部