This was a fairly easy and straight-forward job without requiring any additional APIs. Microsoft Office 2003 was pretty forgiving about Excel file extension that any auto-generated Excel file would be easily accepted without much hiccup. Nowadays, with Office 2007 and the upcoming Office 2010, we again are forced to resort to a "few" different Excel-creation techniques which yielded various pros and cons.
- The should've-been-the-easy-way: (X)HTML+CSS+Excel Formula minus-JavaScript format saved as .xls file.
- The should've-been-just-as-easy-way: Office 2003 XML format saved as .xls file.
- The what-we're-now-forced-to-do: Microsoft OpenXML SDK (2.0) way creating a warning-free Excel 2007 file (SDK 2.0 is the most recent library for Office 2010).
I think I know one of the many reasons Microsoft decided to restrict the flexibility later versions of its Office suite—something to do with all those macro/VBA-infected office files or something like that. So they now go by the "locked-down-by-default" starting point. But I also think it's a crying shame that we get all sort of warning dialogs for file extension renaming and things that are already automatically recognized by Microsoft Office suite, anyway. If only there's a way to suppress the dialog from an administrative policy instead of going to each user's PC... If anything, they should make still automatically protect the end-user while still enabling programmers maintain high-productivity by adopting web document standard but without that whole pop-up dialogs everytime so that worker-bee programmers like myself aren't forced to find, re-devise yet another technique to create, and yet again re-wrap a new set of APIs on a new SDK just to do what's supposed to be a simple thing. Do I digress? Perhaps not. We'll see with the aforementioned techniques in the following illustrations.
(X)HTML && CSS || Excel Formula !JavaScript method
This technique is as simple as it could be; there really is no other additional digging required other than what any web programmer already knows. Anyone could manually write the (X)HTML-based Excel file or use his/her favorite programming language to generate the intended file. You be the judge after seeing the code in Listing 1 below.
| This is Cell A1 in Excel | This is Cell B1 in Excel | |
| 123 | 456 | =A2+B2 |
The advantages of this technique are as apparent as the advantages of following a widely-accepted and standardized document object model, especially one that would be readily usable on a web browser. In addition, this would translate well to the natural order of a spreadsheet being a two-dimensional table understood as rows and columns made up of cells. Those as what
| and other related (X)HTML elements are for.
The one great disadvantage stemmed from an annoyance of the application (understandably) warning the user that the content format is different from what is understood by Excel when looking at an .xls file extension. And it is more often than not sufficient to put-off a client-centric programmer who cares about NOT scaring his customer as much as he does about programming ease and efficiency. Will this image: Up next (Part 2): Office 2003 XML format approach. Saturday, September 06, 2008Confidence == Self.Comfort in {Knowns, Unknowns}Confidence != Perfection; Confidence != Arrogance.Hide(Inferiority); What do we do when a user asks for a facility for a matter of convenience and where the cost of providing such convenience far outweighs the value of the time saved from the convenience? There's a dictum that states: "Customer is King." If we want to be responsible subjects to our king, it is our duties to say to the King: "Your Majesty, if you wear this 'clothes' you will be naked; is that what you really want?" and instead of: "Yes Your Majesty, we will use the finest invisible silk thread to match the invisible royal garb you ordered." Friday, April 11, 2008Joy is...A smile in spite of what's around. You know... these days I sensed a lot of unhappiness around me—not from me, mind you—around me. So I took a few minutes out of my day and scoured the Internet to see if I could find some quick, inspirational statements people say about how we can reach happiness since I don't seem to be doing well in inspiring happiness for others. Here's what I found: From Dennis Wholey: Here's another from our favorite genius, Albert Einstein: From an unknown smartie: How are these useful for me? Eeh, they aren't new to me, really; they're what I already naturally use for me. And I'm happy in a happy-go-lucky-sort-of-way-kind-of-guy; see if these could be as useful for you as they have been for me. Thursday, January 17, 2008What a great {insert a nerdy title here} feels:
Subscribe to:
Posts (Atom)
|

