from VB6  write to html file with style

Posted on 2006-04-29
Medium Priority
Last Modified: 2010-05-01
   I am developing a vb6 windows application. What I really need is to shop the content of a recorset in a browser
I have two approaches in mind
  As I loop thru the recordset , the entries in the recorset are to be written to an xml file and then applying style from an XSL style  sheet  write to an HTML file  . (I have done this in vb.net)

As I loop thru the recorset, the entries are directly written to the html file applying style from a CSS file

In anycase my idea is to show the contents of recordset on an html file applying a style.

 Can you help me?

Question by:sgs1970
  • 3

Accepted Solution

azeemdigitalsoft earned 500 total points
ID: 16571643
Dim fso, F
    Set fso = CreateObject("Scripting.FileSystemObject")
    fname = App.Path & "\" & "ds.html"
    Set F = fso.OpenTextFile(fname, 2, True)
    F.writeline "<HTML>"
    F.writeline "<BODY>"
    F.writeline "<FONT size=2 face=Arial>"
    F.writeline "<center><h2>SALE REPORT AS ON " & DTS.value & "</h2></CENTER>"
    F.writeline "<table width=100% border=1 cellspacing=0 cellpadding=0>"
    F.writeline "<caption><B><FONT size=3 face=Arial BLACK>Sale:</FONT></B></caption>"
    F.writeline "<tr align=center>"
    F.writeline "<td>Product Name</td>"
    F.writeline "<td>Opening</td>"
    F.writeline "<td>Purchase</td>"
    F.writeline "<td>Rate</td>"
    F.writeline "<td>Sale</td>"
    F.writeline "<td>Rate</td>"
    F.writeline "<td>Closing</td>"
    F.writeline "<td>Sale Amount</td>"
    Set RS = New ADODB.Recordset
    RS.Open "SELECT * FROM STOCK ORDER BY DATE", CN, adOpenStatic, adLockOptimistic
While Not RS.EOF
        F.writeline "<tr>"
        F.writeline "<td>" & RS("PRODUCT") & "</td>"
        F.writeline "<td>" & RS("OQTY") & "</td>"
        F.writeline "<td>" & RS("PQTY") & "</td>"
        F.writeline "<td>" & RS("PRATE") & "</td>"
        F.writeline "<td>" & RS("SQTY") & "</td>"
        F.writeline "<td>" & RS("SRATE") & "</td>"
        F.writeline "<td>" & RS("CQTY") & "</td>"
        F.writeline "<td>" & RS("SAMOUNT") & "</td>"

Author Comment

ID: 16575979

   Is there really a way to have an XSL or CSS file . The advantage I seek is , the style can be changed later too without the source code

   Can you help me?

Author Comment

ID: 16676515

 Can Someone help me ?

Author Comment

ID: 16883715

  I accept azeemdigitalsoft 's answer , eventhough it  doesn't  meet  my requirment.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question