如何通过添加带有值的额外新列来下载excel文件 [英] how to download excel file with adding extra new column with value

查看:91
本文介绍了如何通过添加带有值的额外新列来下载excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的应用程序文件夹下载保存的Excel工作表,并添加一个额外的列,即记录用户的公司ID。



我用下面的代码下载excel sheet。



I want to download saved excel sheet from my application folder with adding it one extra column i.e, logged user's company id.

I have used below code for download excel sheet.

string filepath = Server.MapPath("~/Uploads/Sheet1.xlsx");

            FileInfo myfile = new FileInfo(filepath);


            if (myfile.Exists)
            {
                // Clear the content of the response
                Response.ClearContent();

                Response.AddHeader("Content-Disposition", "attachment; filename=" + myfile.Name);
                                Response.AddHeader("Content-Length", myfile.Length.ToString());

                Response.TransmitFile(myfile.FullName);


                Response.End();

推荐答案

您尚未添加任何要添加的代码新栏目。首先打开文件然后添加新列。



从Google搜索样本。你肯定会得到它。
You have not added any code to add new column. Open the file first and then add new column to it.

Search for samples from Google. You will get it for sure.


这篇关于如何通过添加带有值的额外新列来下载excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆