[jawsscripts] Re: How might I code up a table to appear in virtual viewer?

Hi Jeff:
I have not had any personal experience coding this stuff, but I know
that Doug Lee coded some procedures that would write a table to a html
document using the IE object.  If you like I can send you the whole
module which he sent to the list a few years ago, but for now, here are
a few bits of code that will give you some ideas.

his module was called klist.jsl

Here are a few of the relevant functions.

Void Function InitIeObject ()
var
        string objname,
        object o, object oDoc
let objname = "InternetExplorer.Application"
; Use CreateObject, not GetObject, so we always get a new one.
; let o = createObject(objname)
; if !o && getJFWVersion() >= 500619 then
        ; Try forcing use of CoCreateInstance (may help when JAWS is
running as a service)
        let o = createObjectEx(objname, False)
;       if o then sayString("Used CreateObjectEx") endIf  ; TODO:
remove.
EndFunction


object function kl_getDocObject()
; Creates and returns an HTML document object with no content.
var
        string objname,
        object o, object oDoc
let objname = "InternetExplorer.Application"
; Use CreateObject, not GetObject, so we always get a new one.
let o = createObject(objname)
if !o && getJFWVersion() >= 500619 then
        ; Try forcing use of CoCreateInstance (may help when JAWS is
running as a service)
        let o = createObjectEx(objname, False)
;       if o then sayString("Used CreateObjectEx") endIf  ; TODO:
remove.
endIf
if !o then
        return 0
endIf

; Initialize the object for use, and get an actual document object.
let o.visible = 0
o.navigate("about:blank")
let oDoc = o.document
let o.visible = 1

; Return the document object, not the root object.
return oDoc
endFunction

int function kl_writeHeadFoot(object oDoc, string title)
; Handles the header and footer of a document.
; The header is written if title is non-null, otherwise the footer is
written.
; NOTE:  This function currently includes an embedded STYLE section
drawn from the author's document template.
if title then
        kl_writeLine(oDoc, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\">")
        kl_writeLine(oDoc, "<HTML><HEAD>")
        kl_writeLine(oDoc, "<!--")
        kl_writeLine(oDoc, "<style type=\"text/css\">")
        kl_writeLine(oDoc, "td {")
        kl_writeLine(oDoc, "  vertical-align: top;")
        kl_writeLine(oDoc, "}")
        kl_writeLine(oDoc, "</style>")
        kl_writeLine(oDoc, "-->")
        kl_writeLine(oDoc,
        "<TITLE>" +title +"</TITLE>")
        kl_writeLine(oDoc, "</HEAD><BODY>")
        kl_writeLine(oDoc, "<H1>" +title +"</H1>")
else
        kl_writeLine(oDoc, "</BODY></HTML>")
endIf
return True
endFunction


int function kl_writeTable(object oDoc, int starting)
; Writes the HTML for the start/end of a table.
if starting then
        kl_writeLine(oDoc, "<TABLE border=1 cellSpacing=0
cellPadding=0>")
else
        kl_writeLine(oDoc, "</TABLE>")
endIf
endFunction

int function kl_writeRow(object oDoc, int isHeader, string scriptName,
string keyList, string syn, string desc)
; Writes a row of the table generated by this module.
var
        string t1, string t2
if isHeader then
        let t1 = "<TH>"
        let t2 = "</TH>"
else
        let t1 = "<TD>"
        let t2 = "</TD>"
endIf
kl_writeLine(oDoc, "")
kl_writeLine(oDoc, "<TR>")
kl_writeLine(oDoc, t1+scriptName+t2)
kl_writeLine(oDoc, t1+keyList+t2)
kl_writeLine(oDoc, t1+syn+t2)
kl_writeLine(oDoc, t1+desc+t2)
kl_writeLine(oDoc, "</TR>")
return True
endFunction











David Farough
Application Accessibility Coordinator/coordonateur de l'accessibilité 
Information Technology Services Directorate /
Direction des services d'information technologiques
Public Service Commission / Commission de la fonction publique
Email / Courriel:  David.Farough@xxxxxxxxxxxxx
Tel. / Tél:    (613) 992-2779 
__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: