我正在处理 c# 项目,我正在从我的 gridview 生成动态 excel 文件。
当我成功生成文件时,它会将所有数据转换为Genaral类型,但我需要将所有 excel 文件数据转换为Text格式,
我怎样才能做到这一点?因为我需要进一步将此文件用于报告目的并需要Text作为类型
以下是我的excel文件生成c#代码:
private void ExportGridView()
        {
            System.IO.StringWriter sw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
            // Render grid view control.
            gvFiles.RenderControl(htw);
            // Write the rendered content to a file.
            string renderedGridView = sw.ToString();
            File.WriteAllText(@"C:\test\ExportedFile.xls", renderedGridView);
        }

我想我需要使用Microsoft.Office.Interop.Excel并且我可以指定类型也喜欢生成在Text 
我也搜索过,我们可以将它生成为一个类似的 html 包含并使它成为类似的东西。
谁能帮我?