Export Data to text/excel file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bluethunder
    New Member
    • Sep 2007
    • 50

    Export Data to text/excel file

    Good day,

    I have a program where the report has a range before you can preview it. The user wants the record be export to .txt and excel file. Is there any idea how to construct it via code?
  • Sudaraka
    New Member
    • Jan 2011
    • 55

    #2
    It's a simple matter of building the for mat you want in a string and writing it to a file.

    For excel you can use CSV (http://en.wikipedia.org/wiki/Comma-s...es#Basic_rules) format, and the text file can be simillar but columns separated by tab or use fixed length (space padded).

    Only thing to be concerned is the amount of of data you need to write to the file, if it too big you might run out of memory. In that case you will have to stream or buffer the output.

    Comment

    • bluethunder
      New Member
      • Sep 2007
      • 50

      #3
      Is there any sample code so that I could follow it.

      Comment

      • Sudaraka
        New Member
        • Jan 2011
        • 55

        #4
        Try these:
        Blogger is a blog publishing tool from Google for easily sharing your thoughts with the world. Blogger makes it simple to post text, photos and video onto your personal or team blog.

        Comment

        • bluethunder
          New Member
          • Sep 2007
          • 50

          #5
          Thank you for the reply. Both link that you gave to me is for csv file. Is there for txt file?

          Comment

          • Sudaraka
            New Member
            • Jan 2011
            • 55

            #6
            You can use the same for the text files also.
            Only things is that file name should end with .txt extension and format can be any thing you like.

            Comment

            Working...