Gerar mensagem table html para envio email.
Código: Selecionar todos
aVetor:={}
aAdd(aVetor, {'Data e Hora do Erro', hb_DtoC( Date(),"DD/MM/YYYY" ) + " - " + Time()})
aAdd(aVetor, {'Nome do Executável', cExeName})
aAdd(aVetor, {'Data e Hora do Executável', cDataExe})
aAdd(aVetor, {'Nome do Computador', hb_GetEnv("computername", NetName())})
aAdd(aVetor, {'Usuário do Computador', hb_GetEnv("username", NetName(.T.))})
aAdd(aVetor, {'IP/MAC do Computador', aMac[1, 1]+" "+aMac[1, 2]})
aAdd(aVetor, {'Memória Disponível', Transform(LTrim(Str( Memory(0) )),"@R 9,999,999")})
aAdd(aVetor, {'Espaço em Disco', LTrim(Transform(DiskSpace(),"@R 999,999,999,999,999,999"))})
aAdd(aVetor, {'Serial Lógico do HD', Serial_HD() })
aAdd(aVetor, {'Pasta de Diretório', hb_DirBase()})
aAdd(aVetor, {'Sistema Operacional', Os()})
aAdd(aVetor, {'Compilador C', hb_Version(HB_VERSION_COMPILER)})
aAdd(aVetor, {'Versão do Harbour', hb_Version(HB_VERSION_HARBOUR)+ " "+hb_Version(HB_VERSION_BUILD_DATE_STR)})
aAdd(aVetor, {'Versão da HWgUI', hwg_Version( 1 )})
cHtmlErroAdd:=win_AnsiToOem(MontaHtml(aVetor, {"Descrição", "Valor"}))
FUNCTION MontaHtml(aVetor, aCabec)
LOCAL oElemento, cTable
cTable := '<!DOCTYPE html>'+hb_eol()
cTable += '<html>'+hb_eol()
*---------------------------------------
cTable += '<head>'+hb_eol()
cTable += '<style>'+hb_eol()
cTable += 'table, th, td {'+hb_eol()
cTable += ' border: 1px solid black;'+hb_eol()
cTable += ' border-collapse: collapse;'+hb_eol()
cTable += '}'+hb_eol()
cTable += '</head>'+hb_eol()
cTable += '</style>'+hb_eol()
cTable += '<body>'+hb_eol()
cTable += '<table border="1" style="width:100%">'+hb_eol()
cTable += '<table style="width:100%">'+hb_eol()
nCol := Len(aVetor[1])
cTable += '<tr>'
FOR EACH oElemento IN aCabec
cTable += ' <th>'+oElemento+'</th>'+hb_eol()
NEXT
cTable += '</tr>'
FOR EACH oElemento IN aVetor
IF Mod(oElemento:__enumIndex(), 1) = 0
cTable += ' <tr>'+hb_eol()
ENDIF
FOR nCont:=1 TO nCol
cTable += ' <td>'+oElemento[nCont]+'</td>'+hb_eol()
NEXT
cTable += ' </tr>'+hb_eol()
NEXT
cTable += '<body>'+hb_eol()
cTable += '<html>'
hb_Memowrit("tabela.html", cTable)
RETURN cTable