相关疑难解决方法(0)

使用OpenXML C#在Excel中获取单元格的列索引

我一直在寻找一段时间,似乎无法找到如何做到这一点.我有一张excel表,我正在使用OpenXML阅读.现在正常情况是循环遍历行然后循环遍历单元格以获取值,这很好.但是随着值的增加,我需要单元格的位置,格式为(rowindex,ColumnIndex).我已经设法得到了rowIndex,但似乎无法弄清楚索引列.

我实际上认为这很容易,但显然它不是.

c# excel openxml

14
推荐指数
4
解决办法
2万
查看次数

OpenXML 大数据集到 excel 非常慢

我正在使用 OpenXml 将大数据转换为 Excel,并且我正在使用以下导出到 Excel 类

http://www.codeproject.com/Articles/692092/A-free-Export-to-Excel-Csharp-class-using-OpenXML

下面是我班级中的代码。

  public static bool CreateExcelDocumentAsStream(DataSet ds, string filename, System.Web.HttpResponse Response)
    {
        try
        {
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            using (SpreadsheetDocument document = SpreadsheetDocument.Create(stream, SpreadsheetDocumentType.Workbook, true))
            {
                WriteExcelFile(ds, document);
            }
            stream.Flush();
            stream.Position = 0;

            Response.ClearContent();
            Response.Clear();
            Response.Buffer = true;
            Response.Charset = "";

            //  NOTE: If you get an "HttpCacheability does not exist" error on the following line, make sure you have
            //  manually added System.Web to this project's References.

            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            Response.AddHeader("content-disposition", "attachment; filename=" + …
Run Code Online (Sandbox Code Playgroud)

c# excel openxml openxml-sdk c#-4.0

2
推荐指数
1
解决办法
5389
查看次数

标签 统计

c# ×2

excel ×2

openxml ×2

c#-4.0 ×1

openxml-sdk ×1