MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

使用QueryRange( )时,如果查询的范围只有一个column,结果会查询出所有column

Open joeyni-tw opened this issue 3 years ago • 0 comments

Excel Type

XLSX

MiniExcel Version

1.30.1

Description

使用QueryRange( )时,如果查询的范围只有一个column,结果会查询出所有column。

Example

static void Main()
{
    var path = "demo3.xlsx";

    // Would like to query all columns (A, B, C)
    {
        var rows = MiniExcel.QueryRange(path, startCell: "A1", endCell: "C3").ToList();
        foreach (var item in rows)
        {
            Console.WriteLine(item.A + ", " + item.B + ", " + item.C);
        }
        Console.WriteLine();
    }
    // OK

    // Would like to query column A and column B
    {
        var rows = MiniExcel.QueryRange(path, startCell: "A1", endCell: "B3").ToList();
        foreach (var item in rows)
        {
            Console.WriteLine(item.A + ", " + item.B + ", " + item.C);  // fail to query column C
        }
    }
    Console.WriteLine();
    // OK

    // Would like to query column A
    {
        var rows = MiniExcel.QueryRange(path, startCell: "A1", endCell: "A3").ToList();
        foreach (var item in rows)
        {
            Console.WriteLine(item.A + ", " + item.B + ", " + item.C);  // all columns
        }
    }
    // Bug
}

joeyni-tw avatar Feb 13 '23 07:02 joeyni-tw