Coder Social home page Coder Social logo

Mapping doesn't work about linqtoexcel HOT 5 OPEN

paulyoder avatar paulyoder commented on June 22, 2024
Mapping doesn't work

from linqtoexcel.

Comments (5)

paulyoder avatar paulyoder commented on June 22, 2024

Sorry @bzaar, I don't have time to unzip your solution file. Can you provide a little more context and share the exact lines of code you're using.

from linqtoexcel.

bzaar avatar bzaar commented on June 22, 2024

using System;

namespace DictionaryCompiler
{
public class Row
{
public string HeadWord;
}

class Program
{
    static void Main()
    {
        var xl = new LinqToExcel.ExcelQueryFactory {FileName = @"..\..\Test.xlsx"};

        foreach (var row in xl.Worksheet ())
        {
            Console.WriteLine (row ["HeadWord"]);
        }

        xl.AddMapping <Row> (r => r.HeadWord, "HeadWord");

        foreach (var row in xl.Worksheet <Row> ())
        {
            Console.WriteLine (row.HeadWord ?? "NULL");
        }
    }
}

}

Output:

some
test
data

NULL
NULL
NULL
NULL
NULL
Press any key to continue . . .

Expected output:

some
test
data

some
test
data
NULL
NULL
Press any key to continue . . .

Hope this helps.

from linqtoexcel.

isaeed avatar isaeed commented on June 22, 2024

yes having the same issue but found that mapping is not working for xlsx files and works in xls. but even in xls, mapping is not accurate. for mapped fields in xls files, data is not fetched and mapped fields are not working in where clause as well. please verify and advise any solution. thanks

from linqtoexcel.

eldhoabe avatar eldhoabe commented on June 22, 2024

hi isaeed , there might be have some accuracy when having multiple where clause , it better to get the values in memory and include your filtration in memory. i have been used linqtoexcel so much yet i dont have any problem with mapping, if your header name is mapped to the correctly i think u can fetch data.

if your issue persis upload ur excel together .

// i have simple where condition in my xlsx file its working good. if u have filtering try in memory.
var faceMechResult = excel.WorksheetRange("A5", "AS" + _faceMechRows.ToString(), facemechSheetName).
Where(i => i.WorkOrder != null).Select(x => x).ToList();

from linqtoexcel.

isaeed avatar isaeed commented on June 22, 2024

hi eldhoabe ,
thanks for your suggestion about in memory filtration and things are much improved with it.

from linqtoexcel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.