Home > Archive > Programming with dBASE > February 2006 > HTML in memo field









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HTML in memo field
Rick

2006-02-14, 8:23 pm

I have a table that stores a document that is actually HTML code in a memo field. I would like to create a report that, when it is rendered, does not display the HTML code in the field but rather reads the code and displays the formatted text (i.e., WYSI
WYG).

Is there a way to execute the html code in this field so that the memofield contents displays as formatted text when the report is rendered?

Thanks for any ideas on this,
Rick

Ken Mayer [dBVIPS]

2006-02-15, 9:23 am

Rick wrote:
> I have a table that stores a document that is actually HTML code in a memo field. I would like to create a report that, when it is rendered, does not display the HTML code in the field but rather reads the code and displays the formatted text (i.e., WY

SIWYG).
>
> Is there a way to execute the html code in this field so that the memofield contents displays as formatted text when the report is rendered?


The dBASE report designer/engine does this by default ... however,
dBASE's ability to interpret HTML is limited. You might want to consider
sending this to a browser, which would probably require using your own
code to generate the .HTM page(s).

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Rick

2006-02-15, 8:23 pm

Hi Ken,

Hmm...when I place the memofield on a report using a text control it prints with the html code diplayed and does not interpret the code. Maybe I am supposed to use a different control than a text control? But as you said, even if it would, the code in the
memofield may have more complicated html in it than the report writer can handle.

I am setting up an email system, and can use a standard editor control for text email. For html email, I am setting up to use MS Word and creating a .htm file so they have WYSIWIG editing of html. I sure wish I could find an editor control that could do
this instead, but only found one and, while it is a good effort, it doesn't seem to be ready for prime time yet so am stuck with Word.

I thought I might use a ReportViewer control in this form and render the memofield on screen so they could at least see the html email message without loading in Word. Right now, as they browse the table of messages, if a message is html I have to cover
it up and give them a message instead to click on edit in word to see the message. Or I could have a preview button that would use the browser. Either way, they have to load the contents of the memofield in another app instead of just browsing thru mess
ages to see the text.

I explain all this only because I thought you might apply that KM intellect to the problem and see a solution that I do not.

Anyway, thanks for the info,
Rick

Ken Mayer [dBVIPS] Wrote:

> Rick wrote:
WYSIWYG).[color=darkred]
>
> The dBASE report designer/engine does this by default ... however,
> dBASE's ability to interpret HTML is limited. You might want to consider
> sending this to a browser, which would probably require using your own
> code to generate the .HTM page(s).
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase


Ken Mayer [dBVIPS]

2006-02-15, 8:23 pm

Rick wrote:
> Hi Ken,
>
> Hmm...when I place the memofield on a report using a text control it
> prints with the html code diplayed and does not interpret the code.
> Maybe I am supposed to use a different control than a text control?
> But as you said, even if it would, the code in the memofield may have
> more complicated html in it than the report writer can handle.


Weird. When you are using the memo field in a form, do you have the
evalTags property set to false? If so, that may be it ... you might try
in the report to use the canRender event, pull the text from the memo
field and place in a variable, and then set the text property of the
text object ... dunno if that would resolve it (this is not tested):

function Text1_canRender
f = form.streamSource1.rowset.fields
cText = f["MyMemoField"].value.rightTrim()
this.text := cText
return true

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Michael Nuwer [dBVIPS]

2006-02-16, 3:23 am

Ken Mayer [dBVIPS] wrote:
>
>
> The dBASE report designer/engine does this by default ... however,
> dBASE's ability to interpret HTML is limited. You might want to consider
> sending this to a browser, which would probably require using your own
> code to generate the .HTM page(s).


The contents of a memo field could be assigned directly and viewed in
the ActiveX web browser; no need to write it to a disk file.

oDoc = form.activex1.nativeobject.Document()
oDoc.body.innerhtml = "<center><H1>Hi guys</H3></center>"

The following is a working example.

** END HEADER -- do not remove this line
//
// Generated on 02/15/2006
//
parameter bModal
local f
f = new browserForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class browserForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
height = 19.6818
left = 29.7143
top = 3.3636
width = 62.5714
text = "Web Browser"
endwith

this.ACTIVEX1 = new ACTIVEX(this)
with (this.ACTIVEX1)
height = 17.9091
left = 0.0
top = 1.7727
width = 62.5714
pageno = 0
classId = "{8856F961-340A-11D0-A96B-00C04FD705A2}"
anchor = 1 // Bottom
endwith

this.PUSHBUTTON3 = new PUSHBUTTON(this)
with (this.PUSHBUTTON3)
onClick = class::PUSHBUTTON3_O
NCLICK
height = 1.0909
left = 19.2857
top = 0.3636
width = 15.4286
text = "View memo"
endwith


function IsReady
bIsReady = (form.activex1.nativeobject.readystate >= 4)
do while not bIsReady
bIsReady = (form.activex1.nativeobject.readystate >= 4)
form.DoEvents()
enddo
return bIsReady

function form_onOpen
form.activex1.nativeobject.navigate("about :blank")
if form.IsReady()
? 'activex is ready for action'
endif
return true

function PUSHBUTTON3_onClick
oDoc = form.activex1.nativeobject.Document()
oDoc.body.innerhtml = "<center><H1>Hi guys</H3></center>"
return true

// Rich's function
function DoEvents
#Include Windef.h
// Checks for pending Windows messages for any window
// of the current thread
if type( "DispatchMessage" ) # "FP"
extern LONG DispatchMessage(CPTR
) user32 ;
from "DispatchMessageA"
endif
if type( "PeekMessage" ) # "FP"
extern BOOL PeekMessage(LPSTRUCT
URE, CHWND, ;
UINT, UINT, UINT) user32 ;
from "PeekMessageA"
endif
if type( "TranslateMessage" ) # "FP"
extern BOOL TranslateMessage(CPT
R) user32
endif

// Creates a MSG structures
lpMess = replicate( chr( 0 ) , 20 )

do while PeekMessage( lpMess, Null, 0, 0, 1 )
TranslateMessage( lpMess )
DispatchMessage( lpMess )
enddo
return

endclass



Rick

2006-02-16, 1:23 pm

Thanks Ken,

Got a different crisis that needs my attention. Will have to try some things when this fire is out. Thanks for the info.

Rick

Ken Mayer [dBVIPS] Wrote:

> Rick wrote:
>
> Weird. When you are using the memo field in a form, do you have the
> evalTags property set to false? If so, that may be it ... you might try
> in the report to use the canRender event, pull the text from the memo
> field and place in a variable, and then set the text property of the
> text object ... dunno if that would resolve it (this is not tested):
>
> function Text1_canRender
> f = form.streamSource1.rowset.fields
> cText = f["MyMemoField"].value.rightTrim()
> this.text := cText
> return true
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com