FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HTML reports - live preview inside VS Code
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
HTML reports - live preview inside VS Code
Posted: Thu Jul 29, 2021 04:30 PM
Dear Antonio,

I am testing live preview inside VS Code.

Preview your html files in VS Code itself. Use it to quickly set the html and css right for your webpages.


Do you know it live preview is also working for mod harbour?

Best regards,
Otto


Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: HTML reports - live preview inside VS Code
Posted: Fri Jul 30, 2021 06:52 AM
easy peasy lemon squeezy

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: HTML reports - live preview inside VS Code
Posted: Fri Jul 30, 2021 07:39 AM
add: padding


Code (fw): Select all Collapse
<TD WIDTH=50% 
            ALIGN=RIGHT 
            BGCOLOR="#5b9bd5" 
            STYLE="padding: 18px;" >


Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: HTML reports - live preview inside VS Code
Posted: Fri Jul 30, 2021 08:10 AM
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: HTML reports - live preview inside VS Code
Posted: Fri Jul 30, 2021 08:16 AM

Hello Marc,
Yes, this is the function I use.

Best regards,
Otto

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: HTML reports - live preview inside VS Code
Posted: Sat Jul 31, 2021 11:25 AM
Hi,

If I use that Printhtml function, I get a runtime error.

    Application
    ===========
    Path and name: c:\_vmsdata\FWH\Projects\_Test\htmlTabel\TEST.exe (32 bits)
    Size: 1,283,584 bytes
    Time from start: 0 hours 0 mins 0 secs
    Error occurred at: 07/31/21, 13:19:52
    Error description: Error BASE/1004 Message not found: TACTIVEX:DOCUMENT

    Stack Calls
    ===========
    Called from: tobject.prg => TACTIVEX:ERROR(172)
    Called from: tobject.prg => TACTIVEX:MSGNOTFOUND(205)
    Called from: tobject.prg => TACTIVEX:DOCUMENT(0)
    Called from: TEST.PRG => PRINTHTML(57)
    Called from: TEST.PRG => TEST(12)[/list:u]

    The line with the error is:

    Code (fw): Select all Collapse
       do while alltrim(oIe:document:readyState) <> 'complete'
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: HTML reports - live preview inside VS Code
Posted: Sat Jul 31, 2021 03:04 PM

Hello Marc,
please send me your source code.
Best regards,
Otto

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: HTML reports - live preview inside VS Code
Posted: Sat Jul 31, 2021 03:17 PM
Otto,

What is the email adress I can send it to?

Otto wrote:Hello Marc,
please send me your source code.
Best regards,
Otto
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: HTML reports - live preview inside VS Code
Posted: Mon Aug 02, 2021 08:37 PM
Hi;

Thanks to Otto, my test is working.
The problem was that in my testprogram, I didn't opened a window, and directly create an print the html-file.
In a normal program, a window will be open.

Also entering the complete path of the html-file has to done, to made it run.

This is my test-program (with the additional window and path added by Otto)

The function mHTMLtabel() is a funtion I'm creating to generate a HTML-tables.
Until now you can give the size of the table, and the data per field.
It is in a very, very, very early stage of development.
The purpose is also giving the column width, row height, border-type, the font-style, color,... of each cell. Also to merging cells,....


Code (fw): Select all Collapse
#INCLUDE "fivewin.CH"


function Main(cAufruf)
    local oBtn
    local I             := 0
   local oDlg, oFont,  n, oFontBrw, oBTNSave
   local nWidth   := GetSysMetrics( 0 ) * 2/4
   local nHeight  := GetSysMetrics(1 ) * 3/4
   local cTitle   := "/i zi' pi zi/   ***** Reportgenerator"

    *----------------------------------------------------------





    DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-18
   DEFINE FONT oFontBrw NAME 'TAHOMA' SIZE 0,-26

   DEFINE DIALOG oDlg SIZE nWidth,nHeight PIXEL FONT oFont

   @ 20,20  SAY cTitle OF oDlg PIXEL  FONT oFontBrw


@ ( nHeight - 90 ) / 2.05,nWidth/5/2.05 ;
   FLATBTN oBTNSave ;
   PROMPT "Speichern" ;
   SIZE 2, ( 32 ) /2.05 ;
   OF oDlg ;
   ACTION (  test( ) )

@ ( nHeight - 90 ) / 2.05,nWidth/5/2.05+100 ;
   FLATBTN oBTNSave ;
   PROMPT "Abbruch" ;
   SIZE 2, ( 32 ) /2.05 ;
   OF oDlg ;
   ACTION (oDlg:End())

ACTIVATE DIALOG oDlg CENTERED


    RELEASE FONT oFont

    return (0)

//----------------------------------------------------------------------------//





FUNCTION test()
     Local aHoogte := {10,10,10,10,40,10,10,10,10,10}
     local aBreedte := {50,50,50,50,100,50,50}
     local aTekst := {{1,2,3,4,5,6,7},{11,12,13,14,15,16,17},{21,22,23,24,25,26,27},{31,32,33,34,35,36,37},{41,42,43,44,45,46,47},{51,52,53,54,55,56,57},{61,62,63,64,65,66,67},{71,72,73,74,75,76,77},{81,82,83,84,85,86,87},{91,92,93,94,95,96,97}}
     local vhtml
     vhtml = mHTMLtabel(aHoogte,aBreedte,aTekst)

     memowrit('C:\_vmsdata\FWH64\projects\_test\printhtml\test.html',vhtml)

     PrintHtml('C:\_vmsdata\FWH64\projects\_test\printhtml\test.html',1,.t.)

RETURN





//----------------------------------------------------------------------------//
#Define OLECMDID_PRINT                  6
#Define OLECMDEXECOPT_PROMPTUSER        1
#Define OLECMDEXECOPT_DONTPROMPTUSER    2
#Define OLECMDID_ENABLE_INTERACTION     36
#Define OLECMDID_PRINTPREVIEW           7
#Define OLECMDID_SAVEAS                 4
#Define OLECMDID_PAGESETUP              8
#Define OLECMDID_CUT                    11      //Shear
#Define OLECMDID_NEW                    2       //Create a new document
#Define OLECMDID_EXITFULLSCREEN          81
#Define OLECMDID_SAVE                   3       //Preservation

#Define OLECMDID_SETTITLE               28      //Fehler
#Define OLECMDID_ZOOM                   19

// enable print background and images in IE

function PrintHtml ( cHtmlOrUrl, nCopies,lShow )
    static  oIe, oWnd, oPrn
    local i
    *----------------------------------------------------------

    default lShow:=.f.,nCopies:=1

    oIe = TActiveX():New( NIL, "Shell.Explorer" )

    oIe:Do( "Navigate2", cHtmlOrUrl)

    do while alltrim(oIe:document:readyState) <> 'complete'
    sysrefresh()
    waitseconds(.5)
    enddo

    if lshow

    oIe:Do( "ExecWB", OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_PROMPTUSER, OLECMDID_PAGESETUP, OLECMDID_CUT  )

    else
    for i=1 to nCopies
    msgwait('Printing large receipt (' + alltrim(str(i)) + ' of '+alltrim(str(nCopies))+' copies).',,2)
    oIe:Do( "ExecWB", OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER )
    next i
    endif

    sysrefresh()
    oIe:end()
RETURN nil
//----------------------------------------------------------------------------//

func mHTMLtabel(aHoogte,aBreedte,aTekst)
 local vHTML := ''
 local vrij
 local vkol

 vHTML += '<HTML><TABLE border="1">'+ CRLF
 FOR vrij = 1 to len(aHoogte)

    vHTML += '<TR style="height: '+alltrim(str(aHoogte[vrij],10,0))+'px;">'+CRLF
    FOR vkol = 1 to len(aBreedte)
       IF valtype(atekst[vrij,vkol]) = 'N'
       vHTML += '<TD style="width: '+str(aBreedte[vkol],10,5)+'px;">&nbsp;'+str(atekst[vrij,vkol])+'</TD>'+CRLF
       ELSEIF valtype(atekst[vrij,vkol]) = 'C'
       vHTML += '<TD style="width: '+str(aBreedte[vkol],10,5)+'px;">&nbsp;'+atekst[vrij,vkol]+'</TD>'+CRLF
       ELSE
       vHTML += '<TD style="width: '+str(aBreedte[vkol],10,5)+'px;">&nbsp;</TD>'+CRLF
       ENDIF
    NEXT vkol
    vHTML += '</TR>'+CRLF
 NEXT vrij
 vHTML += '</TABLE></HTML>'+CRLF

return vHTML

//----------------------------------------------------------------------------//
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion