********* Start of create_duflp_htm.prg ************ ********** Watch for line wrap *********** /* SOURCE : Sujet : Re: export dbf to excel with headings in background Date : Mon, 08 Oct 2012 22:55:01 +0200 Auteur : "Mervyn Bick" Groupe : dbase.how-to create_duflp_htm.prg Author: Mervyn Bick Date..: May, 2008 Notes.: This program creates a set of HTML pages listing the items contained in the dUFLP. It was intended to be used as an easier way of browsing the dUFLP than by using library.wfm which is included in the dUFLP. The HTML pages complement rather than replace library.wfm as the latter provides a Search facility and, although the source code can be displayed in the browser by clicking on the file name, the HTML page does not provide a list of methods or objects in the particular file.. Usage.: Access the HTML files by calling the following URL from the browser file://localhost/C:/duflp/html/library.htm Tested with dBase Plus v2.6.0.1 under Windows XP Professional, SP3 Tested with Opera, Chrome, FireFox and InternetExplorer v 8 All except IE performed as intended. IE ran the program when the link to the file was clicked instead of opening the text file in the browser. WARNING: The program expects to find the dUFLP in the directory c:\duflp which is the directory recommended for the dUFLP. The program creates a subdirectory c:\duflp\html to hold the HTML pages. These locations are hard-coded throughout the program and they will all need to be changed if you wish to use a different location. */ try mkdir "c:\duflp\html" catch (Exception e) endtry q = new query() q.sql = 'select * from "c:\duflp\library.dbf" order by nameofit' q.active = true // Create framset. library.htm Call this file from the browser. f = new file() f.create("c:\duflp\html\library.htm") f.puts([ ]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.close() // Create html file with header f.create("c:\duflp\html\libhead.htm") f.puts([ ]) f.puts([]) f.puts([]) f.puts([]) f.puts([dUFLP Heading]) f.puts([]) f.puts([]) f.puts([
]) f.puts([
Qu'y a t-il dans dUFLP ?
]) f.puts([


]) f.puts([]) f.puts([]) f.close() // Create html file with index f.create("c:\duflp\html\libindex.htm") f.puts([ ]) f.puts([]) f.puts([]) f.puts([]) f.puts([dUFLP Index]) f.puts([]) f.puts([]) f.puts([
]) f.puts([
]) f.puts([
]) f.puts([
]) f.puts([
]) for n = 65 to 90 f.puts([       ]+ chr(n)+[
] ) next f.puts([]) f.puts([]) f.close() // Create empty html files for each letter in case a letter is not used. // These files will immediately be overwritten with files containing details // // As the dUFLP stands at present, all the letters of the alphabet are user // so this section of code is actually redundant and could be commented out. for n = 65 to 90 f.create("c:\duflp\html\libtext"+lower(chr(n))+".htm") f.puts([ ]) f.puts([]) f.puts([]) f.puts([]) f.puts([dUFLP Index]) f.puts([]) f.puts([]) f.puts([
]) f.puts([
]) f.puts([
]) f.puts([
]) f.puts([
]) f.puts([No entries starting with ]+ chr(n)+[.
] ) f.puts([]) f.puts([]) f.close() next // Create html files with details for each letter of the alphabet cInitial = " " do while not q.rowset.endofset if lower(substr(q.rowset.fields["nameofit"].value,1,1)) <> cInitial cInitial = lower(substr(q.rowset.fields["nameofit"].value,1,1)) f.create("c:\duflp\html\libtext"+cInitial+".htm") f.puts([ ]) f.puts([]) f.puts([]) f.puts([]) f.puts([dUFLP Listing]) f.puts([]) f.puts([]) endif do while lower(substr(q.rowset.fields["nameofit"].value,1,1)) = cInitial f.puts([
]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) // construction du lien pour ouvrir le fichier *cLink = []+trim(q.rowset.fields["whereitis"].value)+[] f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.puts([]) f.puts([
]+q.rowset.fields["nameofit"].value + []+cLink +[]+q.rowset.fields["Author"].value+[
]) f.puts([
]) f.puts([]) f.puts([]) f.puts([
]+q.rowset.fields["description"].value +[


]) f.puts([
]) f.puts([
]) q.rowset.next() enddo f.puts([]) f.puts([]) f.close() enddo ********* End of create_duflp_htm.prg ***********