| Lescasse Consulting |
| Home Company News Prices Download Buy Forums |
|
|
Printer Friendly
See also:
The purpose of THTML5 is to progressively build an HTML page, using various methods. THTML5 maintains the generated HTML code in what is called an HTML buffer. Most of the THTML5 methods add code to the HTML buffer.
It also contains a ConvertExcel method to convert an Excel document into an HTML document.
'html'Œwi'*Create' 'THTML5'('debug'1)
The debug property is used to display an APL window with Internet Explorer always rendering your HTML buffer as it is so far.
The first thing to do is to always use the Start method:
'html'Œwi'Start' 'My Home Page'
The Start method is one of the methods which returns the current content of the HTML buffer.
You generally use THTML5 by first defining various styles using the AddStyle method, for example:
'html'Œwi'AddStyle' 'BODY
{background: url(//Dell8200/C/APLWin/Objects/apl2000a.gif) no-repeat center center}'
The Add method is used to add text to the HTML buffer using various HTML tags and styles:
'html'Œwi'Add' 'H1' 'My Home Page'
This result in the following window poping up in the upper right corner of the screen:
At any time you may want to remove a style. This is done using the RemoveStyle method:
'html'Œwi'RemoveStyle' 'BODY'
and you may review all the styles defined in the page with the read-only styles property:
'html'Œwi'styles'
To use a given style, you may specify it as the second argument to the Add method:
'html'Œwi'Add' 'H1.warning' 'An APL Web Site!'
At any time you may review the HTML code produced so far, by invoking the html property:
'html'Œwi'html'
The ShowCode method is a little similar to the html property except that it completes the HTML buffer with the final necessary closing tags:
'html'Œwi'ShowCode'
To add content to the page, use the Add method. This method accepts 2 or more arguments.
Its second argument is either an HTML tag name, or one of the existing styles defined in the page. If you have defined class styles, like: .aplfont independant of any selector, you may use it with any HTML tag as follows: DIV.aplfont
The remaning arguments are one or more character vectors representing the content to be added to the page.
For example, the Add method can be used to add paragraphs of text as follows:
par1„'This is the 1st paragraph of text in my
Web Site.<br>',Œtcnl
resutling in:
At any time you may call the Clear method to remove any content from the page. Note that only content within the <BODY> tag is removed.
Example:
'html'Œwi'Clear'
It is very easy to add any table to the HTML page, by invoking the AddTable method.
Simply create any APL nested matrix of any depth and pass to the AddTable method as its second argument.
The AddTable method 1st argument is a character string of parameters for the <TABLE> tag.
Example:
aaa„10 10½¼100000 bbb„5 5½1000×¼100 bbb[2;3]„ 3 3½'APL*PLUS PC' 'STSC'1982 'APL*PLUS II' 'STSC'1986 'APL+Win' 'APL2000'1997 aaa[3;4]„ bbb 'html'Œwi'AddTable' ' border="1" cellpadding="0" cellspacing="0"' aaa
This results in the following HTML table being created:
THTML5_3.gif
THTML5 provides a method for converting Excel .XLS documents to HTML: ConvertExcel
Although Microsoft Excel also provides the same functionnality from its SaveAs menu, the HTML conversion performed by Excel has a number of flaws, one of them being that merged cells are not properly converted.
To convert an Excel document, you must use the ConvertExcel method and pass to it:
l the Excel document file name l the sheet numbers of the sheets to convert to HTML
Each specified sheet is converted to an .HTML document saved in the your Excel document HTML subdirectory. If such a directory does not exist, the ConvertExcel method creates it. The saved .HTML documents take the name of the Excel sheets to which they correspond.
Example:
Assume you have an Excel document named H:\Aplwin\OBJECTS6\Excel\Essai Tableau1.xls with 2 sheets named Tableau1 and Tableau2 which looks like this:
THTML5_4.gif
Let's convert both sheets to HTML documents with:
'html'Œwi'*Create' 'THTML5'('debug'1) 'html'Œwi'ConvertExcel' 'H:\Aplwin\OBJECTS6\Excel\Essai Tableau1.xls' (1 2)
This creates 2 HTML files named Tableau1.htm and Tableau2.htm (look at the sheet names in the Excel document above) which are saved in the H:\Aplwin\OBJECTS6\Excel\Html directory. Since this directory did not yet exist, it is created first.
If you double click on one of these HTML files, here is how it gets displayed in the browser (note: using Internet Explorer is highly recommended).
THTML5_5.gif Excel document converted to HTML with the THTML5 ConvertExcel method
Note that the ConvertExcel method seems to do a better HTML conversion job than the Excel Save As Web Page feature does. Here is what you would get by saving your document as an HTML page from within Excel:
THTML5_6.gif Excel document converted to HTML by Excel Save As Web Page menu
As this picture shows, there are several problems with the Excel conversion to HTML:
l titles and cells in general are vertically bottom aligned l Excel does not convert cells with the Center Across other cells horizontal alignment correctly l Excel displays vertical cell borders where it sometimes should not l Excel does not display the grid within the table
|
||||||||||||||||||
| This entire Web site has been dynamically generated by APL+Win Objects™ 6.0 For all questions contact: info@lescasse.com Copyright © 2003-2005 Lescasse Consulting. All rights reserved. |