Displaying CDO Data
From previous chapters, you already know how to traverse the CDO object model. For a review of the CDO object model, refer back to Chapter 5. In the current chapter, I won’t spend time on the structure of CDO. Rather, I’ll focus on explaining how to display CDO’s various objects on a web page.
To display CDO data on a web page, it is necessary to generate HTML that represents the data, and to send that HTML to the user’s browser. There are two ways to generate the HTML. One is to execute script that reads CDO object properties and constructs HTML strings based on property values, and the other is to pass CDO objects to CDO Rendering Library objects and to ask the CDO Rendering Library objects to create the HTML.
Generating HTML in Script
Example 11-6 shows a function that takes as an argument a
CDO InfoStores collection object and returns an HTML string
representing the list of InfoStore objects in the collection. In this
example I chose to build a one-column HTML table, with one row per
information store. The names of the information stores are displayed
in the cells of the table. I have also used line breaks
vbCrLf) and white space to make the generated
HTML more readable to anyone viewing the raw HTML. This is for
aesthetic reasons only, and has no effect on the browser’s
display. Example 11-7 shows an example of the HTML
this function might generate for an InfoStores collection having two
Example 11-6. Rendering an InfoStores Collection