SaveAs option for an asp.net web form.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: SaveAs option for an asp.net web form.

  1. #1
    usha Guest

    SaveAs option for an asp.net web form.


    Hi,
    I have an aspx in which I am displaying a table of records, fetched from
    database.
    Can I give a SaveAs button option on this form, to save the data displayed
    as a PDF/Excel file... ???

    Plz Reply ASAP,
    Thanx in advance,
    Usha.

  2. #2
    S Guest

    Re: SaveAs option for an asp.net web form.


    Just why not? you can write a CBC (code behind code) to do this. I have used
    the following code for saving as a text file. This won't work for saving
    as pdf/excel but you can do a similar thing for those, if you know the file
    formats and those are not difficult to find (try google). Then the code has
    to be in VB/Java or C#. Pick your choice.
    S
    ----------
    // if there is an existing text file, delete it first.
    File.Delete("D:\\NewFile.txt");
    TextWriter output = File.AppendText("d:\\NewFile.txt");
    string line = "";

    for (int k=0; k<86; k++)
    {
    line = Part1Answers[k] + "\t" + Part2Answers[k] + "\t" +
    Part3Answers[k] + "\t" + Part4Answers[k] + "\t" + Part5Answers[k];
    output.WriteLine(line);
    }
    ----------
    "usha" <usharani.m@sonata-software.com> wrote:
    >
    >Hi,
    > I have an aspx in which I am displaying a table of records, fetched from
    >database.
    > Can I give a SaveAs button option on this form, to save the data displayed
    >as a PDF/Excel file... ???
    >
    >Plz Reply ASAP,
    >Thanx in advance,
    >Usha.



  3. #3
    S Guest

    Re: SaveAs option for an asp.net web form.


    Check this link and follow the page's other links too. Even if you are coding
    in a language other than C#, the idea would help implement the same. Hope
    this helps.

    http://www.c-sharpcorner.com/Code/20...fConverter.asp

    S

    "usha" <usharani.m@sonata-software.com> wrote:
    >
    >Hi,
    > I have an aspx in which I am displaying a table of records, fetched from
    >database.
    > Can I give a SaveAs button option on this form, to save the data displayed
    >as a PDF/Excel file... ???
    >
    >Plz Reply ASAP,
    >Thanx in advance,
    >Usha.



  4. #4
    usha Guest

    Re: SaveAs option for an asp.net web form.


    But what is the loop limit ,ie 86 here .???
    And what are this PartnAnswers[]???

    "S" <vb.@127.0.0.1> wrote:
    >
    >Just why not? you can write a CBC (code behind code) to do this. I have

    used
    >the following code for saving as a text file. This won't work for saving
    >as pdf/excel but you can do a similar thing for those, if you know the file
    >formats and those are not difficult to find (try google). Then the code

    has
    >to be in VB/Java or C#. Pick your choice.
    >S
    >----------
    >// if there is an existing text file, delete it first.
    >File.Delete("D:\\NewFile.txt");
    >TextWriter output = File.AppendText("d:\\NewFile.txt");
    >string line = "";
    >
    >for (int k=0; k<86; k++)
    >{
    >line = Part1Answers[k] + "\t" + Part2Answers[k] + "\t" +
    > Part3Answers[k] + "\t" + Part4Answers[k] + "\t" + Part5Answers[k];
    >output.WriteLine(line);
    >}
    >----------
    >"usha" <usharani.m@sonata-software.com> wrote:
    >>
    >>Hi,
    >> I have an aspx in which I am displaying a table of records, fetched

    from
    >>database.
    >> Can I give a SaveAs button option on this form, to save the data displayed
    >>as a PDF/Excel file... ???
    >>
    >>Plz Reply ASAP,
    >>Thanx in advance,
    >>Usha.

    >



  5. #5
    Russell Jones Guest

    Re: SaveAs option for an asp.net web form.

    There are so many options. The simplest and most flexible is to put the
    relational data in a DataSet. Then you can
    * use XSL-FO to transform the XML representation of the dataset into a PDF
    file and save the results
    * save the Dataset (in XML format) to a file.
    * save the Dataset in binary format to a file.
    * save it as an HTML table, (which is readable from Excel)
    * save it in Excel's native format by creating an instance of Excel,
    creating a worksheet, and populating the worksheet with the data.
    * save it as a tab-delimited or commas-delimited text file
    etc..




    "usha" <usharani.m@sonata-software.com> wrote in message
    news:3ea3df78@tnews.web.devx.com...
    >
    > But what is the loop limit ,ie 86 here .???
    > And what are this PartnAnswers[]???
    >
    > "S" <vb.@127.0.0.1> wrote:
    > >
    > >Just why not? you can write a CBC (code behind code) to do this. I have

    > used
    > >the following code for saving as a text file. This won't work for saving
    > >as pdf/excel but you can do a similar thing for those, if you know the

    file
    > >formats and those are not difficult to find (try google). Then the code

    > has
    > >to be in VB/Java or C#. Pick your choice.
    > >S
    > >----------
    > >// if there is an existing text file, delete it first.
    > >File.Delete("D:\\NewFile.txt");
    > >TextWriter output = File.AppendText("d:\\NewFile.txt");
    > >string line = "";
    > >
    > >for (int k=0; k<86; k++)
    > >{
    > >line = Part1Answers[k] + "\t" + Part2Answers[k] + "\t" +
    > > Part3Answers[k] + "\t" + Part4Answers[k] + "\t" + Part5Answers[k];
    > >output.WriteLine(line);
    > >}
    > >----------
    > >"usha" <usharani.m@sonata-software.com> wrote:
    > >>
    > >>Hi,
    > >> I have an aspx in which I am displaying a table of records, fetched

    > from
    > >>database.
    > >> Can I give a SaveAs button option on this form, to save the data

    displayed
    > >>as a PDF/Excel file... ???
    > >>
    > >>Plz Reply ASAP,
    > >>Thanx in advance,
    > >>Usha.

    > >

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center