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. Tuesday, February 24, 2009One ID to rule them all!Having an OpenID is a cool thing. In theory, I wouldn't have needed to register for any other account ever. Alas, most ideals are just that: ideals. No, I'm not saying anything bad against OpenID; I'm only saying that even with the best intention we still frequently are unable to realize the full potential of the idea's ideals. Take SourceForge.Net for example, it's one of sites I frequented. Sure it does take my OpenID to authenticate me when I logged into the site, but it still requires me to bind to a local SourceForge account if I want to use it to access certain things such as its CVS repositories. C'est la vie. The OpenID provider I chose for my use is MyOpenID.com. I like MyOpenID.com because it is one of only a few (as of this writing) strong authentication providers who uses SSL certificates and Windows CardSpace/InfoCards which enables auto-authentication. This is so that while I do have a password for my OpenID account, I won't need to really memorize it or use it to sign into any sites using my OpenID account. To demonstrate:
Tuesday, February 17, 2009How to write clean website layout using CSS (Part 2)The pure <div/> approach: Positions Creating web page layout using CSS positioning really is a very simple thing to do. All we need to remember is that an XHTML element's absolute position is always relative to its container. That is the one thing we usually forget. We are so caught up in the semantic definition of the word absolute position we forget that it isn't absolute only in the context of the web page itself (<body/>). For a similar simple markup we wrote in Listing 2 of our previous notes, we now have the following Listing 1. The styling commands we needed in Listing 2 felt simpler to do and easier to understand from the perspective of having to think about how the browser layout engine will interpret the commands we write. I'd say it looks pretty straightforward without having spent lots of hours tweaking the style attributes to get the desired results. I was pretty happy this turned out to be easy. But then just for kicks I wanted to find out "What if I did the other way around, strictly with floats and kept all the elements' positions at its default relative value?" "Would it be just as simple?" "Would it be just as quick to do?" The pure <div/> approach: Floats With the same base structural template as Listing 1 above, I found that achievement the desired result using float method is considerably longer. Sure if you look at the last CSS code-block of Listing 2, you'll see that I actually cheated by using floats because well... that was actually the simplest way to order the <div/>'s in simple column formation. But then, to figure out which of the <div/>'s in square formation need to be floated the right way took quite a bit of trial and error in the order of magnitude of 5. Yes. Five. Listing 2 took me only a couple of minutes to write and get right. Listing 3 took me almost 15 minutes to do due to tinkering with the float and clear attribute combinations. How to write clean website layout using CSS (Part 1)There are three well-known techniques in creating a website layout using CSS:
There are others of course; very advanced CSS masters like to further enhance the cleanliness of their XHTML code without using a single <div/> or <span/>. As I jumped into refresher exercises, I wondered: "How easily would it be for me to do this (ref: screen)?" Or, "Is it even possible to easily do it for the four popular browsers today?" Warning: At the time of writing, the following materials were only proofed on:
This article merely documents these variations and choices. We do not advocate one approach versus another as these choices are left to each of our individual circumstances and reasons. Although <grin/> I would soon give up doing the first approach. The base skeletal structure for each of the tested approaches is the following Listing 1(with slight differences): The <table/> approach If we search the Internet for arguments against using <table/> tags for layout purposes, we will find them in abundance. They are all valid arguments and we should heed them. I simply could not bring myself to nest <table/> tags like it's 1999. The <table/> + <div/> approach For the following simple layout in Listing 2:
We still had the following styling code in Listing 3 Yes, this approach yields a slightly cleaner code result than only the <table/> based approach. But it isn't without its own problems. There's that <tr/> rendering issue in IE. And of course, I found that the CSS implementation differences between the various browsers render this approach virtually indefensible, as in saying: "If we have to resort to using various CSS tricks/hacks anyway, why not simply do a Table-less Layout with its pros and cons already weighed by the web design community at large, especially when we already have ample samples written by masters such as those from A LIST apart and Zen Garden—two sources of my favorites reading materials where I found a wealth of knowledge shared to us all common netizens." Need I say more? Up next: The pure <div/> approach (Part 2). Thursday, February 12, 2009How to create a new Blogger template (Part 2)Blogger's Layout Data Tags For details on why That's pretty much it. The rest, we can just drop widget definitions following this Blogger Widget article and regular X/HTML web-design exercises. The following is the result of this new Blogger template exercise.
How to create a new Blogger template (Part 1)
Dissecting a Blogger's basic default template Leave the first two lines alone. Listing 1: After the first two lines of code, a Blogger's template is essentially just a regular X/HTML document (according to the specified DOCTYPE in code line #2). Side notes: Personally, I use XHTML 1.0 Transition for reasons we'll experience when we exercise the coding style I wrote in here: How to write clean X/HTML document. For this reason, in the remaining content of this study assumes and follows the transitional document type declaration. Basic X/HTML coding An X/HTML document essentially consists of simple structural tags as seen in Listing 2 below. Despite all of the content we see when view an X/HTML document on the web, that's really all there is to it. A Blogger's template is no exception. The some differences we see in the basic template we've downloaded usually has to do with what Blogger labels "Layout Data Tags" or, for those used to using Blogger's WYSIWYG layout editing tool, "Widgets" (regardless of whether or not they're displayed on the resulting browser screen). In Blogger's document template case, there are extra namespaces declared as attributes of the <html> tag as shown in Listing 3 below. We should do the same. Tuesday, February 10, 2009How to write clean X/HTML documentWarning: XMP tag is an officially deprecated tag as of HTML specification 3.02. So follow this advise at your own risk. tags to pre-format ourmultiline texts inside a tag. HI THERE! XMP is sweet. I don't know why such as useful tag is deprecated. XMP is sweet. I don't know why such as useful tag is deprecated. HI THERE! XMP is sweet. I don't know why such as useful tag is deprecated. My multi line content inside a paragraph <p/> tag My multi line content inside a paragraph <p/> tag All we have to do is use a CSS class as we would in any other case: For example: we could do the following:Listing 4: <xmp style="color: blue; font-weight: bold;">Content</xmp>
Subscribe to:
Posts (Atom)
|


