SUBSTR(lcText, 1, LEN(lcText) - LEN("<tr><td>") - 1)Cetin
>lparameters tcCharacterSet >LOCAL i, lcFileName, lcText, lcCharacterSet >LOCAL ARRAY laFiles[1] > >if vartype(tcCharacterSet) = 'C' > lcCharacterSet = tcCharacterSet >else > lcCharacterSet = "windows-1251" >endif > >FOR i = 1 to ADIR(laFiles, "*.csv") > lcFileName = laFiles[i, 1] > lcText = FILETOSTR(lcFileName) > lcText = STRTRAN(lcText, CHR(13), "</td></tr>" + CHR(13) + CHR(10) + "<tr><td>") > lcText = STRTRAN(lcText, ",", "</td><td>") > lcText = "<tr><td>" + SUBSTR(lcText, 1, LEN(lcText) - LEN("<tr><td>")) > buildHTML(lcFileName, lcText, FORCEEXT(lcFileName, "html"), lcCharacterSet) >ENDFOR >RETURN > >FUNCTION buildHTML (tcTitle, tcOutput, tcOutputFile, tcCharacterSet) > >set textmerge to (tcOutputFile) noshow >set textmerge on >text ><html> ><head> > <meta http-equiv="Content-Type" content="text/html; charset=<<tcCharacterSet>>"> > <title><<tcTitle>></title> ></head> ><body> ><table> ><<tcOutput>> ></table> ></body> ></html> >endtext >set textmerge off >set textmerge to >ENDFUNC >