PC SOFT
DEPOT EN LIGNE
POUR WINDEVWEBDEV ET WINDEV MOBILE

WD Switching from the RTF format to the HTML format - WD Mudando do formato RTF para o formato HTML
Publié par Boller
dans la catégorie Outils
Nouveautés



Description
WD Switching from the RTF format to the HTML format - WD Mudando do formato RTF para o formato HTML

// temporary variable used to retrieve the HTML code of RTFToHTML
sTmp is string
// initialize the control
HTML2 = ""
// transform a RTF document into an HTML document
sTmp = RTFToHTML(SCRTF1.TextInput)

// display in the HTML control
HTML2 = "<html>"+sTmp+"</html>"

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

// initialize the control
sText = ""
// transform an RTF document into a Text document
sText = RTFToText(SCRTF1.TextInput)

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

File is string // full path of the RTF file to open
HTMLFile is string // full path of the HTML file to write
FileID is int // identifier of the RTF file to read
sLine is string // line of the file
sContent is string // content of the RTF file
sHTMLContents is string // content of the HTML file

// Open a RTF document
File = fSelect("", "", "Select a file...", "RTF files (*.RTF)"+TAB+"*.rtf", "*.rtf", fselOpen+fselExist)
IF File <> "" THEN
// open the RTF file
FileID = fOpen(File,foRead)
// read the first line
sLine = fReadLine(FileID)
WHILE sLine <> EOT
// add the line to the total content of the file
sContent += sLine
sLine = fReadLine(FileID)
END
// transform into HTML
sHTMLContents = RTFToHTML(sContent)
//trace(sHTMLContent)
//backup of the HTML file
HTMLFile = fSelect("", "", "Save as...", "HTML file (*.html)"+TAB+"*.html", "*.html", fselCreate)
IF HTMLFile <> "" THEN
// save the HTML file
IF fSaveText(HTMLFile,"<html>"+sHTMLContents+"</html>") THEN
IF YesNo(Yes,"Do you want to view the HTML file?") = Yes THEN
ShellExecute(HTMLFile)
ELSE
Info("The file was saved at the following location: "+CR+HTMLFile)
END
ELSE
Error("The file was not saved")
END
ELSE
Info("The HTML file was not saved")
END
ELSE
Info("No selected RTF file")
END

Illustrations, copies d'écran
none
none
Avis des utilisateurs
(Pour noter la ressource, cliquez sur Ecrire un avis)
Aucun avis ou commentaire ? Soyez le premier !