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().


    <FONT color=#0000ff>this._sourcePreviewSpread.ActiveSheet.LoadTextFile(sourceFileReader.BaseStream, true,
                                FarPoint.Win.Spread.Model.IncludeHeaders.None, "\n", ",", "\"");</FONT>


    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.


    <FONT color=#008000>// This line of data is loaded correctly</FONT>
    <FONT color=#0000ff>"1275,abc",0,0,150000,1275 - Sale to XYZ Company</FONT>


    <FONT color=#008000>// The modified line does not load correctly, text qualifier added to the columns
    </FONT><FONT color=#0000ff>"1275,abc","0","0","150000","1275 - Sale to XYZ Company"</FONT>


    <FONT color=#008000>//  I tried a work around for the above line to work correctly.(Added a “,” to the end of the line).</FONT>
    <FONT color=#0000ff>"1275,abc","0","0","150000","1275 - Sale to XYZ Company",</FONT>


    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

    <FONT face=Arial size=2>Thanks Scott. The solution also worked for me.</FONT>

Need extra support?

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

Learn More

Forum Channels