Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Browser HTML Editor

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
AU
This might sound a little silly, but I can't seem to be able to set a default font. It keeps reverting to Times Roman.
I send formatted text in the font I prefer, also preload blank document with the font in the HTML paragraph tag, but where it falls down is when text is cut & pasted.
This occurs when cutting & pasting in the same doument. New paragraphs default to Times Roman.
 
It's not clear what the context of your question is. Your post is headed "Web Browser HTML Editor". What is that? Are you referring to the Microsoft Web Browser ActiveX control in edit mode?

If so, then the default font is determined by settings in the instance of Internet Explorer installed on the user's system. You can change that via HTML or CSS. But if you then want to preserve the formatting on a copy-and-paste, you would have to be sure to also copy and paste the relevant tags.

If I have misunderstand your question, please clarify what exactly you are doing.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,
Yes you are right, sorry about that. I am referring to the Web Browser in edit mode.
If the default font is controlled by internet explorer, I guess I just have to get our users to set a more appropriate default font themselves.

Thanks
 
That's right. But you can always change the default for a given document by inserting the appropriate tags programmatically. I guess you would do that at the point where you create the initial blank document. But those tags would then apply to the document as a whole, rather than to individual pieces of text.

I've never done this myself, so can't be sure it would work, but it would be worth a bit of experimentation.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I am having some success with setting the font with the tags. However, with copy and paste, depending on where the inertion point for the past is, will result in the text being returned to default.

I kick start the document like this:

Code:
lcHTMLFile="body.htm"
lcFile = lcDir + lcHTMLFile

STRTOFILE("<P><FONT face=Calibri></FONT></P>",lcFile)

I will experiment with other tags like 'body', see how I get on
 
You rather use the style attribute since about 1998.

<BODY STYLE="FONT-FAMILY:Calibri;Helvetica;Arial;Sans-Serif;"></BODY>

And that'll make that the body default and fall back to Helvetica, Arial or any no serif font, if Calibri isn't present.

Bye, Olaf.

 
Olaf is right about using the Style attribute rather than the Font attribute. But the main point there is to use it with the Body tag, not the individual paragraph. That way, the font will remain in force for the whole document. That's what I meant when I said to apply the tags to the document as a whole.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
And I'll be the contrarian in the room and point out that you shouldn't get too hung up on appearance if you're using HTML. The appearance for the recipient will be entirely controlled by THEIR environment.

If you want control over appearance, HTML is the wrong format. Something like a PDF is designed to preserve appearance across systems. HTML is not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top