Problem while using LoadTextFile() to load data

Posted by: leomathew on 8 September 2017, 12:42 pm EST

  • Posted 8 September 2017, 12:42 pm EST

     I am trying to load data from a text file to a far point grid using the method LoadTextFile().


    this._sourcePreviewSpread.ActiveSheet.LoadTextFile(sourceFileReader.BaseStream, true,
                                FarPoint.Win.Spread.Model.IncludeHeaders.None, "\n", ",", "\"");


    In some cases, the delimiter character is present within the data. For the far point grid to not treat that as a delimiter, I set the “cell delimiter” parameter to “\””  (double quote). This seems to work. But in cases where the last column of data is enclosed within a double quote (and no delimiter is present at the end of line), it does not work.


    // This line of data is loaded correctly
    "1275,abc",0,0,150000,1275 - Sale to XYZ Company


    // The modified line does not load correctly, text qualifier added to the columns
    "1275,abc","0","0","150000","1275 - Sale to XYZ Company"


    //  I tried a work around for the above line to work correctly.(Added a “,” to the end of the line).
    "1275,abc","0","0","150000","1275 - Sale to XYZ Company",


    Does any one know how the farpoint win spread can be loaded without using the above workaround.


    Thanks in advance.

  • Replied 8 September 2017, 12:42 pm EST

    Hello,


    I would suggest switching your row delimiter from "\n" to "\r\n". When I changed to use that as the row delimiter, then it loaded the string correctly.

  • Replied 8 September 2017, 12:42 pm EST

    Thanks Scott. The solution also worked for me.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels