Could you please point me in the right direction?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chloejacobs
    New Member
    • Apr 2009
    • 2

    Could you please point me in the right direction?

    Hi every1!

    My first post on Bytes :)

    I want to create a simple web page that will read of CSV file, sort the file by certain fields, take out duplicate entries if 3 fields have the same value and then write the amended csv file to a XLS file?

    Is this possible and could you please point me in the right direction?

    Kind Regards,
    Chloe ~X~
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    in case there is no user-interaction between all the steps you mentioned, then it is quite easier to upload the file to the server, process it there and send back the xls-file ... i assume that a user has the csv file and should get an xls file from it?

    kind regards

    Comment

    • chloejacobs
      New Member
      • Apr 2009
      • 2

      #3
      Hi,

      Yeah the user will have the csv file and will upload to the page and then once the duplicates have been removed from the csv they will receive a xls file by downloading it?

      Where would i start to achieve this? What should i be reading up on? Is there a csv reader or should i use Stream reader?

      Kind Regards,
      Chloe ~X~

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        i'm not very familiar with those .NET things but i guess that there are some components that you might use to read a file and produce an xls from it. i just wanted to say that in your current case it is the better way to do all this serverside than trying to do it clientside. may be some of the .NET experts could give you more specific hints for the concrete components that you might use ... a google search for .NET csv reader and writing xls-files gave me a lot of hits ...

        kind regards

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          It sounds like you already have a good idea of how to do this.

          Upload the file to the server.
          Once you have it there, load the file into memory.
          Then manipulate the file according to your requirements.
          Then save the file.


          Just remember that CSV files are comma delimited....

          There is tons of stuff on google for this type of thing too...

          Once you've attempted the problem and get stuck post back here on Bytes and we'll help you through your problem.

          -Frinny

          Comment

          • dorandoran
            New Member
            • Feb 2007
            • 145

            #6
            on user interface:
            Browse for file > Select a File > Read the file > out put to box on the screen
            Code:
            private void openFile_Click(object sender, System.EventArgs e)
            {
            openFileDialog.ShowDialog();
            }
            
            private void openFileDialog_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
            {
            string fullPathname = openFileDialog.FileName;
            FileInfo src = new FileInfo(fullPathname);
            filename.Text = src.Name;
            source.Text = "";
            TextReader reader = src.OpenText();
            string line;
            while ((line = reader.ReadLine()) != null)
            {
            source.Text += line + "\n";
            }
            reader.Close(); // !!! dont forget !!!
            }

            from MS Press Visual C# Step by step
            Last edited by Frinavale; Apr 8 '09, 01:53 PM. Reason: Added code tags. Please post code in [code] [/code] tags.

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              Pssst Dorandoran, this is an ASP.NET application and so there is no OpenFileDialog available ;)

              Comment

              Working...