MeadInKent
| Javascripts values on web pages | Alphabetical Index |

Insert data into web pages using iFrames

This site has descriptions of several methods of including words or tables from external files within an HTML page. Unless you use data islands (which are redundant in modern browsers) XML files are complicated. Files based on javascript coding may be unfamilar and trigger security warnings.

Possibly the easiest and most conventional method of inserting data is to use InLine Frame (iFrame) elements. Paragraphs or tables can be exported from Excel or Access and saved in small HTML files. The host web page includes an instruction which calls the HTML text file and inserts it in a particular posiiton. One limitation with iFrames is that you need to specify the actual size of the inserted frame. If the size of your data can vary, the resulting pages can include blank spaces or need scroll bars to reveal all of the data.

The inserted items do not adopt the formatting characteristics of the host page. Styles will need to be defined in the external files.

The following iFrame includes a file which is too large for the defined iFrame and which does not contain any formatting instructions. It contains both a paragraph and a 3 x 3 table.




A source of data to be included in a web page


excel data used as a basis for a web report

The formula which reads this data and creates a useful paragraph is:

="Expenditure this month is " & TEXT(C9,"#,##0") & ". This is " & B14 & " of " & TEXT(B12,"#,##0") & " (" & TEXT(B13,"0.0%") & ")"

Example one - inserting a paragraph

Item included
in page

A paragraph on the parent page before the frame.

Another paragraph on the parent page following the frame.

HTML code in
the external file
<style type='text/css'>
body { font-family: Arial, Helvetica; font-size: 11pt; margin-left: 0; margin-right: 0}
p {font-size: 11pt; text-align: justify; color: blue}
</style>
<p>Expenditure this month is 21,943. This is a reduction of 1,169 (5.1%)</p>
HTML code in
parent page
<iframe src='ifr_file_two.htm' width='100%' height='35' frameborder='0' scrolling='auto'>
Your browser does not support inline frames
</iframe>

Example two - inserting a table

Item included
in page

A paragraph on the parent page before the frame.

Another paragraph on the parent page following the frame.

HTML code in
the external file
<style type='text/css'>
body {margin-left: 0; margin-right: 0 }
table {font-family: Arial; border-collapse: collapse; font-size: 11pt; border: 2 solid silver}
th {padding: 1pt 3pt 2pt 3pt; border-style: solid; border-width: 1; font-size: 11pt; font-weight:
normal; border-color: silver }
td {padding: 1pt 3pt 2pt 3pt; border-style: solid; border-width: 1; border-color: silver }
</style>

<table width='500'>
<thead bgcolor='#D7F2FF'><tr><th>Clinic Expenditure</th><th>Last month</th><th>This
month</th></tr></thead>
<tr><td>Drugs</td><td align='right'>4,665</td><td align='right'>4,601</td></tr>
<tr><td>Surgical equipment</td><td align='right'>2,840</td><td align='right'>3,511</td></tr>
<tr><td>Appliances</td><td align='right'>385</td><td align='right'>450</td></tr>
<tr><td>Patients literature</td><td align='right'>152</td><td align='right'>110</td></tr>
<tr><td>Room hire</td><td align='right'>15,006</td><td align='right'>13,200</td></tr>
<tr><td>Surgical waste</td><td align='right'>64</td><td align='right'>71</td></tr>
<tr><td>Total</td><td align='right'>23,112</td><td align='right'>21,943</td></tr>
</table>
HTML code in
parent page
<iframe src='ifr_file_three.htm' width='100%' height='195' frameborder='0' scrolling='auto'>
Your browser does not support inline frames.
</iframe>

A VBA program can be used in Excel to automate the creation of the external HTML files.


This page is not included in the Functions Guide
which contains help about Excel functions
Document is in PDF format Click here for details about
obtaining this file

file: WebPage_iFrame.htm Page last updated: Feb14 MeadInKent.co.uk 2014 CMIDX S5 P13 N