C#中对Excel文件执行写数据操作

C#中对Excel文件执行写数据操作:

先编写一个函数

private static string CPath(string path)
    {
        var index = path.LastIndexOf("/");
        var temp = path.Substring(0, index);
        if (!Directory.Exists(temp))//如果不存在就创建file文件夹                               
            Directory.CreateDirectory(temp);//创建该文件夹    
        return path;
    }
复制代码

写入数据操作,代码添加在使用函数中。

猜你喜欢

转载自www.cnblogs.com/ming-4/p/12446884.html