Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 605013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:06:01+00:00 2026-05-13T17:06:01+00:00

I have a very specific problem and i’m looking for input on a good

  • 0

I have a very specific problem and i’m looking for input on a good way to approach it.

edit:(simplified question)

Essentially I have been working on a remote monitoring system for retail kiosks. I am operating within a framework that is entirely dependent on AJAX. I have been using XML to pass data between the clientside/serverside scripts that I use.

On the clientside a user is presented with a datepicker (jquery) and my script pulls any data that is relevant.

Now, I have been charged with the task of taking these tables (populated via ajax) and exporting them to excel. I would like this functionality to be as flexible as possible. This is a very young project and the requirements will be changing from client to client. Flexibility, simplicity, and rapid development are my primary concerns. Data will vary from one table with simple data structure, to very non-uniform ways of storing data. ex: multiple tables, images, graphs.

EDIT: A key to my situation is that I am not open to any third-party extensions that are not widely utilized, professional, and will continue to be developed for quite some time. Ex: JQuery.

Easy enough… right?

I did a bit of research and stumbled upon this PEAR plugin to make exporting to excel via PHP easy. Good to go, I wrote a script that takes an array and writes it to a spreadsheet.

Now, how do I pass the data to this function?

I have decided that it is essential to do this from the clientside. I have hard-coded table headers that I am planning on including in the spreadsheet.

I’ve recently discovered it’s not really all that practical to ship the data via AJAX to my Excel-exporting class due to the inability to actually send the file (which is done via the headers).

I have a scope issue. How to pass the data from clientside -> serverside outside of my ajax driven framework.

I have several approaches I’m looking at for where to actually retrieve the data from.

1)Read the data from the HTML of a table, format it into JSON, pass via form submission to my excelWriter.php file. This has the advantage of efficiency and clarity.

BUT it limits the excelWriter.php to only printing elements that I specifically code it to handle. This function will be complex, given that data might be formatted differently in the future. I would need to be able to pull data from multiple tables (how do I pull that data?), images, graphs rendered in flash (might not be possible…).

I am concerned about rewriting this function every time I add a new type of data or display.

2) Pull the data as I am formatting it into html. Essentially, I am parsing this response object and formatting it into a string and rendering it into HTML. I could take relevant data, images, graphical elements, and shove them into a json generating function.

The benefit to this is I would have exact control over when and where I pull data. It would be really simple to execute, modify, and get a finished version of this script.

The drawbacks are obvious. Readability is sacrificed, it’s not object oriented… not all that creative (i like being creative =P)

snippet:

$.each(results.sale, function(i)
{
 if(difference >=2)
 {
  this.time = String(this.time);
  this.time = this.time.substr(5,2)+'/'+this.time.substr(8)+'/'+this.time.substr(0,4);
  //this.time would be packaged in a json object, along with other data i'd like to export to excel
 }

 htmlStr += "    <tr>"; 
 htmlStr += '     <td class="contentTableKey">'+ this.time +'</td>';
 htmlStr += '     <td class="contentTableValue">$'+this.amount+'</td>';
 htmlStr += "    </tr>";

 total += parseInt(this.amount);
});

htmlStr += '    </tbody>';
htmlStr += '    <tfoot>';
htmlStr += '     <tr>';
htmlStr += '      <td id="salesTotal" class="contentTableValue"></td>';
htmlStr += '      <td id="salesTotal" class="contentTableValue">$'+total+'</td>';
htmlStr += '     </tr>';
htmlStr += '    </tfoot>';
htmlStr += '   </table>';
htmlStr += '  </div></div>';
htmlStr += ' </li>';
htmlStr += '</ul>';

$("#contentData").html(htmlStr);

It’s a bit long, and detailed (too detailed??). Thanks for taking the time to read this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:06:01+00:00Added an answer on May 13, 2026 at 5:06 pm

    I can’t claim to fully grasp your question yet (it is a long one! :), and I’m not sure whether it will help you but do you know Downloadify?

    Downloadify is a tiny JavaScript + Flash library that enables the generation and saving of files on the fly, in the browser, without server interaction.

    You may be able to write out a HTML file, or a new XML-Style excel file (or at least some format that Excel can digest) and offer it as a file download that way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 293k
  • Answers 293k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can do complex objects and lists with the default… May 13, 2026 at 6:32 pm
  • Editorial Team
    Editorial Team added an answer The easiest option is to attach a debugger set to… May 13, 2026 at 6:32 pm
  • Editorial Team
    Editorial Team added an answer OleDB can only read the raw data in the cells.… May 13, 2026 at 6:32 pm

Related Questions

I have a very specific problem here. I have a multi-dimensional array that I
I have implemented a very basic plug-in system as part of a static library
Ok, so I have a very simple form with next to no logic in
I am thinking of implementing a ribbon GUI in one of my apps and
I have a very specific html table construct that seems to reveal a Gecko

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.