Results 1 to 5 of 5

Thread: setup headings

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    I am new to HTML, can anyone advise me on how to fix this bit of code? I need to set up Column headings on a page and the following code does it (incorrectly). How does this work, how can I align as I need to? Any other tips or advice.

    My data will also need to be aligned but if I can understand the headings, then I should be able to extrapolate into the data columns.

    Code:
    'Write headings	
    'Write First Row of Headings
    	TabOpenRow
    	TabWriteCell "",3,"","",0," "
    	TabWriteCell "",2,"center","Arial",2,"<strong>Readings</strong>"
    	TabWriteCell "",2,"","",0,"&nbsp;"
    	TabWriteCell "",1,"right","Arial",2,"<strong>Units</strong>"
    	TabWriteCell "",1,"","",0,"&nbsp;"
    	TabWriteCell "",4,"right","Arial",2,"<strong>Units</strong>"			
    	TabWriteCell "",1,"right","Arial",2,"<strong>Unit Price</strong>"
    	TabWriteCell "",1,"right","Arial",2,"<strong>Discount</strong>"
    	TabWriteCell "",1,"centre","Arial",2,"<strong>Charge</strong>"
    	TabCloseRow
    'Write Second Row of Headings
    	TabOpenRow
    	TabWriteCell "",3,"","",0,"&nbsp;"
    	TabWriteCell "",1,"centre","Arial",2,"<strong>Present</strong>"
    	TabWriteCell "",1,"","",0,"&nbsp;"
    	TabWriteCell "",1,"centre","Arial",2,"<strong>Previous</strong>"
    	TabWriteCell "",1,"","",0,"&nbsp;"
    	TabWriteCell "",1,"right","Arial",2,"<strong>Used</strong>"
    	TabWriteCell "",1,"","",0,"&nbsp;"
    	TabWriteCell "",4,"right","Arial",2,"<strong>Charged</strong>"
    	TabWriteCell "",1,"right","Arial",2,"<strong>(£)</strong>"
    	TabWriteCell "",1,"right","Arial",2,"<strong>(£)</strong>"
    	TabWriteCell "",1,"centre","Arial",2,"<strong>(£)</strong>"
    	TabCloseRow

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    You'd need to post the function your calling in your code to see what your doing. I would not recomend building tables this way. It will be very slow and inefficient to have a function call for each cell.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184


    Sorry, I should have posted it - here it is.

    If it is not good to make this function call what else can I do? There is a lot of this kind of formating (ie for data below columns etc). And its used to set out other parts of the pages.

    Code:
    Sub TabWriteCell(pstrWidth,pintColSpan,pstrAlign,pstrFontFace,pintFontSize,pstrContent)
    	Response.Write("<td")
    	If pstrWidth <> "" Then	Response.Write(" width='" & pstrWidth &"'")
    	If pintColSpan <> 1 Then Response.Write(" colspan='" & pintColSpan & "'")
    	If pstrAlign <> "" Then Response.Write(" align='" & pstrAlign &"'")
    	Response.Write(">")
    	If pstrFontFace <> "" Then Response.Write("<font face='" & pstrFontFace &"' size='" & pintFontSize & "'>")
    	Response.Write(pstrContent)
    	If pstrFontFace <> "" Then Response.Write("</font>")
    	Response.Write("</td>")
    End Sub

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Code:
    <HTML>
    <BODY>
    <TABLE border=1>
    	<TR><%
    		TabWriteCell "",3,"","",0,"&nbsp;"
    		TabWriteCell "",3,"center","Arial",2,"<strong>Readings</strong>"
    		TabWriteCell "",1,"","",0,"&nbsp;"
    		TabWriteCell "",1,"right","Arial",2,"<strong>Units</strong>"
    		TabWriteCell "",1,"","",0,"&nbsp;"
    		TabWriteCell "",4,"right","Arial",2,"<strong>Units</strong>"			
    		TabWriteCell "",1,"right","Arial",2,"<strong>Unit Price</strong>"
    		TabWriteCell "",1,"right","Arial",2,"<strong>Discount</strong>"
    		TabWriteCell "",1,"centre","Arial",2,"<strong>Charge</strong>"
    	%></TR>
    	<TR><%
    	TabWriteCell "",3,"","",0,"&nbsp;"
    	TabWriteCell "",1,"centre","Arial",2,"<strong>Present</strong>"
    	TabWriteCell "",1,"","",0,"&nbsp;"
    	TabWriteCell "",1,"centre","Arial",2,"<strong>Previous</strong>"
    	TabWriteCell "",1,"","",0,"&nbsp;"
    	TabWriteCell "",1,"right","Arial",2,"<strong>Used</strong>"
    	TabWriteCell "",1,"","",0,"&nbsp;"
    	TabWriteCell "",4,"right","Arial",2,"<strong>Charged</strong>"
    	TabWriteCell "",1,"right","Arial",2,"<strong>(£)</strong>"
    	TabWriteCell "",1,"right","Arial",2,"<strong>(£)</strong>"
    	TabWriteCell "",1,"right","Arial",2,"<strong>(£)</strong>"
    	%></TR>
    </TABLE>
    </BODY>
    </HTML>
    
    <%
    Sub TabWriteCell(pstrWidth,pintColSpan,pstrAlign,pstrFontFace,pintFontSize,pstrContent)
    	Response.Write("<td")
    	If pstrWidth <> "" Then	Response.Write(" width='" & pstrWidth &"'")
    	If pintColSpan <> 1 Then Response.Write(" colspan='" & pintColSpan & "'")
    	If pstrAlign <> "" Then Response.Write(" align='" & pstrAlign &"'")
    	Response.Write(">")
    	If pstrFontFace <> "" Then Response.Write("<font face='" & pstrFontFace &"' size='" & pintFontSize & "'>")
    	Response.Write(pstrContent)
    	If pstrFontFace <> "" Then Response.Write("</font>")
    	Response.Write("</td>")
    End Sub
    %>

    If your doing conditional formatting, the functions may make sense but it will still be slower. You won't notice the slowdown until you have lots of data to put in the table. Looks like you had your colspan parameters a little mixed up and just had the wrong number of columns for everything to line up. If you turn the border on, you can see this, then once you have it set up the way you want, set border=0.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    Big thanks monte96, thanks for making the effort to suss
    my problem then offer a solution. Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width