HTML Editor
HTML Editor
I want the user to setup an email template (using basic Bold, Underline, Colour functions, even imbed pics as a "nice to have") so that I can merge it with data from the database.
My thinking is that the email template will look like this:
Dear <<firstname>>
You have <<qty>> items on back order. These items will be ready on <<date>>.
Which when 'filled in' becomes:
Dear Johnny
You have 8 items on back order. These items will be ready on 2007/05/05.
Where I am stuck is giving the user a basic, easy HTML editor. Does anyone know of something I can use? I don't want to have to write an HTML editor - (I don't think I could anyway), but I feel its 'reinventing the wheel'.
All comments / advice appreciated.
My thinking is that the email template will look like this:
Dear <<firstname>>
You have <<qty>> items on back order. These items will be ready on <<date>>.
Which when 'filled in' becomes:
Dear Johnny
You have 8 items on back order. These items will be ready on 2007/05/05.
Where I am stuck is giving the user a basic, easy HTML editor. Does anyone know of something I can use? I don't want to have to write an HTML editor - (I don't think I could anyway), but I feel its 'reinventing the wheel'.
All comments / advice appreciated.
Many thanks
Ollie.
Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Ollie.
Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Re: HTML Editor
Dear Johnny,Ollie wrote:I want the user to setup an email template (using basic Bold, Underline, Colour functions, even imbed pics as a "nice to have") so that I can merge it with data from the database.
My thinking is that the email template will look like this:
Dear <<firstname>>
You have <<qty>> items on back order. These items will be ready on <<date>>.
Which when 'filled in' becomes:
Dear Johnny
You have 8 items on back order. These items will be ready on 2007/05/05.
Where I am stuck is giving the user a basic, easy HTML editor. Does anyone know of something I can use? I don't want to have to write an HTML editor - (I don't think I could anyway), but I feel its 'reinventing the wheel'.
All comments / advice appreciated.
you can write your mails with RTF and with IRUN.DLL convert to html.
1. Download irun.dll from http://www.pilotltd.com/
2. regsvr32 irun.dll /s
3. Insert this function to sour source:
DLL32 FUNCTION EXRTF2WEB( cSource AS LPSTR, ;
cDest AS LPSTR, ;
nOption AS LONG, ;
cBG AS LPSTR, ;
cTitel AS LPSTR, ;
nDPI AS LONG ) AS LONG ;
PASCAL FROM "EXRTF2WEB" LIB "IRUN.DLL"
4. Write your mail in rtf with TRichEdit() and save it to an file.
5. Convert your Mailtext from rtf to html with:
cRTFfile := "Test.rtf" // Sample
cHTMfile := "Test.htm" // Sample
EXRTF2WEB( cRTFfile, cHTMfile, 16, "FFFFFF", "Title", 72 )
it works fine and converts all fonts, bolds, understikes .....
Regards, Norbert
- danielr cyberia®
- Posts: 28
- Joined: Sat Apr 28, 2007 4:06 am
- Location: Venezuela
nk, hi how are you
it's wonderfull this solutions, but i have a problem with the image resource, because the images save to wmf -windows meta file - and the html don't support this ext. i can get gif image when i change a value but don't looking well.
anybody had trying this///
i wish to use this dll or another one but with this result.
thanks a lot
daniel rivas
it's wonderfull this solutions, but i have a problem with the image resource, because the images save to wmf -windows meta file - and the html don't support this ext. i can get gif image when i change a value but don't looking well.
anybody had trying this///
i wish to use this dll or another one but with this result.
thanks a lot
daniel rivas
Best Regards- Saludos y Exitos
Daniel Rivas
Daniel Rivas
Please look at the new Version 1.20 on http://www.pilotltd.com/irun/index.htmldanielr cyberia® wrote:nk, hi how are you
it's wonderfull this solutions, but i have a problem with the image resource, because the images save to wmf -windows meta file - and the html don't support this ext. i can get gif image when i change a value but don't looking well.
Regards, NorbertIRun can generate GIF images for WMF or EMF type of images or can leave the original image depending on your selections. You can change the generated image size by determining the DPI setting for the conversion process.
Re: HTML Editor
hi,
CAN YOU HELP ME TO GET DPI from a generic bmp files ?
tks
Romeo
CAN YOU HELP ME TO GET DPI from a generic bmp files ?
tks
Romeo
Re: HTML Editor
I use the mail merge function of MS WORD (Office) for this task.
Best regards,
Otto
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: HTML Editor
Otto,
Would you be so kind to post an example ? thanks
Would you be so kind to post an example ? thanks
Re: HTML Editor
There is not much programming necessary in FIVEWIN .
1) I create a mail merge recipients file which is a ASCII file.
This file has a header line where all the merge fields are stored and then as many data lines as recipients are.
The merge fields and data fields are separated by a delimiter.
2) insert data and I check that there is no delimiter inside the data.
3) I start word and open the selected mail merge letter.
4) Then complete it in word.
Note If you're creating merged e-mail messages or faxes, make sure that your data file includes a column for the e-mail address or fax number. You will need that column later in the process.
Best regards,
Otto
1) I create a mail merge recipients file which is a ASCII file.
Code: Select all
dateineu := fcreate( cAppPath + "TempWord\recipients.txt",0)
This file has a header line where all the merge fields are stored and then as many data lines as recipients are.
Code: Select all
hStrg:= 'EMAIL;ANREDE;NAME;VORNAME;ZUSATZ;STRASSE;LKZ;PLZ;ORT;BRIEFANRED;TITEL;FIRMA1;FIRMA2'
2) insert data and I check that there is no delimiter inside the data.
Code: Select all
do while .not. eof()
hStrg:= ;
(STRTRAN(ALLTRIM(kunden->email ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->ANREDE ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->NAME ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->VORNAME ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->ZUSATZ ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->STRASSE ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->LKZ ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->PLZ ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->ORT ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->BRIEFAN ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->TITEL ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->FIRMA1 ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->FIRMA2 ), ";","," ))
FSEEK(dateineu,0,2)
lStatus:=FWRITE(dateineu,hStrg+CRLF,)
skip
enddo
Code: Select all
WinExec(PathWinword + "winword.exe" + " " + cDOCFile )
Note If you're creating merged e-mail messages or faxes, make sure that your data file includes a column for the e-mail address or fax number. You will need that column later in the process.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
Re: HTML Editor
Ollie wrote:Where I am stuck is giving the user a basic, easy HTML editor. Does anyone know of something I can use? I don't want to have to write an HTML editor - (I don't think I could anyway), but I feel its 'reinventing the wheel'.
You can avoid using third party external DLL to convert .RTF to .Html file. This can be done using the following codeNK wrote:you can write your mails with RTF and with IRUN.DLL convert to html.
1. Download irun.dll from http://www.pilotltd.com/
2. regsvr32 irun.dll /s
3. Insert this function to sour source:
Code: Select all
#Include "FiveWin.ch"
// Word HTML format constant, used to save Rtf as Html
#DEFINE wdFormatHTML 8
#DEFINE wdFormatFilteredHTML 10
*-------------------------------------*
Function Main()
*-------------------------------------*
Local cRtfFile,cHtmlFile
cRtfFile:="D:\Test\MyRtfFile.Rtf"
cHtmlFile:="D:\Test\MyHtmlFile"
Rtf2Html(cRtfFile,cHtmlFile)
RETURN NIL
*-------------------------------------*
Function Rtf2Html(cRtfFile,cHtmlFile)
*-------------------------------------*
Local oWordApp,oWordDoc,oError
TRY
oWordApp := CreateObject("Word.Application")
CATCH
MsgInfo("MS-Word is not installed in your PC")
Return NIL
END
//Open the RTF document
TRY
oWordDoc:=oWordApp:Documents:Open(cRtfFile)
CATCH oError
MsgInfo("Error. Unable to Open the File"+CRLF+oError:Description)
oWordApp:Quit()
Return NIL
END
//Save the document in HTML format
oWordDoc:SaveAs (cHtmlFile, wdFormatFilteredHTML)
//Free memory & resources by closing objects
oWordDoc:Close()
oWordApp:Quit()
Return NIL
Regards
Anser
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: HTML Editor
Mr Anser
Have you found any code to print RTF directly without opening in a visual control first?
Can you post any such working VB code here? We can convert to FiveWin code.sample VB codes are available which we can easily transfer/convert to FiveWin code and this code can be used to directly convert Rtf to Html within FiveWin itself without using any third party DLL.
Have you found any code to print RTF directly without opening in a visual control first?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: HTML Editor
Dear Mr.Rao,
Unable to paste the entire code here as it exceeds the maximum allowed characters 60,000. Please download it from the below given link
http://www2.bitstream.net/~bradyh/downl ... tmlrm.html
Regards
Anser
Not yet.Mr.Rao wrote:Have you found any code to print RTF directly without opening in a visual control first?
Here is the VB code which I have found on the web. I have not tested it.Mr.Rao wrote:Can you post any such working VB code here? We can convert to FiveWin code.
Unable to paste the entire code here as it exceeds the maximum allowed characters 60,000. Please download it from the below given link
http://www2.bitstream.net/~bradyh/downl ... tmlrm.html
Regards
Anser
Re: HTML Editor
Dear Mr.Rao,
This step-by-step article describes how to print the content of a RichTextBox control. The RichTextBox control does not provide any method to print the content of the RichTextBox. You can extend the RichTextBox class to use EM_FORMATRANGE message to send the content of a RichTextBox control to an output device such as printer.
http://support.microsoft.com/default.as ... -us;812425
Here is another code which I have come across. You may get some hint on how to proceed further. It seems that this VB Code is making use of EM_FORMATRANGE as suggested by Microsoft.
This function allows you to set margins when printing the contents of a rich text box. The margin parameters are set in inches.
Declarations
Code :
Regards
Anser
As per MicroSoft siteMr.Rao wrote:Have you found any code to print RTF directly without opening in a visual control first?
This step-by-step article describes how to print the content of a RichTextBox control. The RichTextBox control does not provide any method to print the content of the RichTextBox. You can extend the RichTextBox class to use EM_FORMATRANGE message to send the content of a RichTextBox control to an output device such as printer.
http://support.microsoft.com/default.as ... -us;812425
Here is another code which I have come across. You may get some hint on how to proceed further. It seems that this VB Code is making use of EM_FORMATRANGE as suggested by Microsoft.
This function allows you to set margins when printing the contents of a rich text box. The margin parameters are set in inches.
Declarations
Code: Select all
Option Explicit
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type CHARRANGE
cpMin As Long
cpMax As Long
End Type
Private Type FORMATRANGE
hdc As Long
hdcTarget As Long
rc As Rect
rcPage As Rect
chrg As CHARRANGE
End Type
Private Const WM_USER As Long = &H400
Private Const EM_FORMATRANGE As Long = WM_USER + 57
Private Const EM_SETTARGETDEVICE As Long = WM_USER + 72
Private Const PHYSICALOFFSETX As Long = 112
Private Const PHYSICALOFFSETY As Long = 113
Private Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function SendMessage Lib "USER32" _
Alias "SendMessageA" (ByVal hWnd As Long, ByVal msg As Long, _
ByVal wp As Long, lp As Any) As Long
Code: Select all
Public Function PrintRTFWithMargins(RTFControl As Object, _
ByVal LeftMargin As Single, ByVal TopMargin As Single, _
ByVal RightMargin As Single, ByVal BottomMargin As Single) _
As Boolean
'********************************************************8
'PURPOSE: Prints Contents of RTF Control with Margins
'PARAMETERS:
'RTFControl: RichTextBox Control For Printing
'LeftMargin: Left Margin in Inches
'TopMargin: TopMargin in Inches
'RightMargin: RightMargin in Inches
'BottomMargin: BottomMargin in Inches
'***************************************************************
On Error GoTo ErrorHandler
'*************************************************************
'I DO THIS BECAUSE IT IS MY UNDERSTANDING THAT
'WHEN CALLING A SERVER DLL, YOU CAN RUN INTO
'PROBLEMS WHEN USING EARLY BINDING WHEN A PARAMETER
'IS A CONTROL OR A CUSTOM OBJECT. IF YOU JUST PLUG THIS INTO
'A FORM, YOU CAN DECLARE RTFCONTROL AS RICHTEXTBOX
'AND COMMENT OUT THE FOLLOWING LINE
If Not TypeOf RTFControl Is RichTextBox Then Exit Function
'**************************************************************
Dim lngLeftOffset As Long
Dim lngTopOffSet As Long
Dim lngLeftMargin As Long
Dim lngTopMargin As Long
Dim lngRightMargin As Long
Dim lngBottomMargin As Long
Dim typFr As FORMATRANGE
Dim rectPrintTarget As Rect
Dim rectPage As Rect
Dim lngTxtLen As Long
Dim lngPos As Long
Dim lngRet As Long
Dim iTempScaleMode As Integer
iTempScaleMode = Printer.ScaleMode
' needed to get a Printer.hDC
Printer.Print ""
Printer.ScaleMode = vbTwips
' Get the offsets to printable area in twips
lngLeftOffset = Printer.ScaleX(GetDeviceCaps(Printer.hdc, _
PHYSICALOFFSETX), vbPixels, vbTwips)
lngTopOffSet = Printer.ScaleY(GetDeviceCaps(Printer.hdc, _
PHYSICALOFFSETY), vbPixels, vbTwips)
' Get Margins in Twips
lngLeftMargin = InchesToTwips(LeftMargin) - lngLeftOffset
lngTopMargin = InchesToTwips(TopMargin) - lngTopOffSet
lngRightMargin = (Printer.Width - _
InchesToTwips(RightMargin)) - lngLeftOffset
lngBottomMargin = (Printer.Height - _
InchesToTwips(BottomMargin)) - lngTopOffSet
' Set printable area rect
rectPage.Left = 0
rectPage.Top = 0
rectPage.Right = Printer.ScaleWidth
rectPage.Bottom = Printer.ScaleHeight
' Set rect in which to print, based on margins passed in
rectPrintTarget.Left = lngLeftMargin
rectPrintTarget.Top = lngTopMargin
rectPrintTarget.Right = lngRightMargin
rectPrintTarget.Bottom = lngBottomMargin
' Set up the printer for this print job
typFr.hdc = Printer.hdc 'for rendering
typFr.hdcTarget = Printer.hdc 'for formatting
typFr.rc = rectPrintTarget
typFr.rcPage = rectPage
typFr.chrg.cpMin = 0
typFr.chrg.cpMax = -1
' Get length of text in the RichTextBox Control
lngTxtLen = Len(RTFControl.Text)
' print page by page
Do
' Print the page by sending EM_FORMATRANGE message
'Allows you to range of text within a specific device
'here, the device is the printer, which must be specified
'as hdc and hdcTarget of the FORMATRANGE structure
lngPos = SendMessage(RTFControl.hWnd, EM_FORMATRANGE, _
True, typFr)
If lngPos >= lngTxtLen Then Exit Do 'Done
typFr.chrg.cpMin = lngPos ' Starting position next page
Printer.NewPage ' go to next page
Printer.Print "" 'to get hDC again
typFr.hdc = Printer.hdc
typFr.hdcTarget = Printer.hdc
Loop
' Done
Printer.EndDoc
' This frees memory
lngRet = SendMessage(RTFControl.hWnd, EM_FORMATRANGE, _
False, Null)
Printer.ScaleMode = iTempScaleMode
PrintRTFWithMargins = True
Exit Function
ErrorHandler:
Err.Raise Err.Number, , Err.Description
End Function
Private Function InchesToTwips(ByVal Inches As Single) As Single
InchesToTwips = 1440 * Inches
End Function
Anser
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: HTML Editor
Mr Anser
Thanks for all the trouble you have taken at my request.
Once we open an RTF document in a control, FWH RichEdit control also allows us to print.
What I have been looking is whether we can print RTF without opening in a VISUAL control first.
My purpose is this: I have a table with some columns containing RTF data. Can I show RTF in xbrowse, like multiline memo, without opening a control in that cell and whether i can print the formatted content in a cell using Report.
I shall go through the code you posted and link you provided.
Thanks again
Thanks for all the trouble you have taken at my request.
Once we open an RTF document in a control, FWH RichEdit control also allows us to print.
What I have been looking is whether we can print RTF without opening in a VISUAL control first.
My purpose is this: I have a table with some columns containing RTF data. Can I show RTF in xbrowse, like multiline memo, without opening a control in that cell and whether i can print the formatted content in a cell using Report.
I shall go through the code you posted and link you provided.
Thanks again
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 824
- Joined: Thu Oct 13, 2005 7:39 am
- Location: Germany
Re: HTML Editor
Nages,
there is also a "Windowless Richtedit Control", which may solve your problem.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
there is also a "Windowless Richtedit Control", which may solve your problem.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
kind regards
Stefan
Stefan