3 Replies Latest reply on Oct 28, 2011 9:42 AM by MSPMarathon

    Export xml blob data to Excel

    satyasuppu Level 1

      Hi ,

       

       

        I need help in exporting data into excel file .

       

      I am storing the data from UI in xml format in blob file in Database.Now i need to export this xml data into excel file using application.Please help me how can we  export data into excel file.Please help me.

       

       

      Thanks in advance.

      SAtya

        • 1. Re: Export xml blob data to Excel
          MSPMarathon Level 1

          If you have a webpage built in Flex you can write the information into a .CSV or another format readable by excel into a file on your server, then open a window to navigate to that page in order for the user to be able to download the file.  If you have a desktop Air application you can write the file to the computer somewhere and do the same thing.

          • 2. Re: Export xml blob data to Excel
            satyasuppu Level 1

            Hi,

             

            Thanks for your reply.

             

            Its web application.Used flex for UI. In UI i have Export and Export ALL values in combo.If i select Export, it should read the xml clob data and show that data in Exce or csv..This is the functionality.

            I need to read the xml_clob inside the database and put each item in excel. The columns in excel should be each of the xml elements e.g.

             

             

            <ns1:FinancialRisk>BBB</ns1:FinancialRisk>

            <ns1:Instrument>

            <ns1:InstrumentTypeCode>EQUITY</ns1:InstrumentTypeCode>

            </ns1:Instrument>

            <ns1:Price>

            <ns1:PriceValue>33.5</ns1:PriceValue>

            </ns1:Price>

             

            How to  read and put tis data into the CSv or excel?Please provide me some sample code if possible.That would be greatful.

            Thaks,

            satya

            • 3. Re: Export xml blob data to Excel
              MSPMarathon Level 1

              loop through and read all records into a string with whatever format you need CSV(Comma Separated Values) is easy because you just have to add a comma between each value in the record and i believe its just a newline character to go to the next value.  Something like this(below) once you have built your string:

               

              var fr:FileReference = new FileReference();// reference to where you want to save the file.

              var csv:String = 'The String you have created in CSV format';

              var ba:ByteArray = new ByteArray();

              ba.writeMultiByte(csv, 'utf-8');

              fr.save(ba);

               

              Then you can open that file in your browser to download it.