Solved

DHTMLEdit Property Change

Posted on 2002-05-05
2
532 Views
Last Modified: 2010-05-18
How to change property of same page (page and cell background color, bg image etc...) with TDHTMLEdit component ?

Thanks.
0
Comment
Question by:cvbn
  • 2
2 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 500 total points
ID: 6990524
hi,
to set background color:

var
 p : olevariant;
begin
p := '$ff00ff';
DHTMLEdit1.DOM.Set_bgColor(p);
or
DHTMLEdit1.oleobject.DOM.Set_bgColor(p);
or
from DHTMLEdit1.OLEOBJECT.DOM.body. you have access to  the html elements
so
DHTMLEdit1.OLEOBJECT.DOM.body.bgcolor := '$ff00ff';
will also work.

also Background image:

DHTMLEdit1.OLEOBJECT.DOM.body.BACKGROUND := 'D:\spawntest.jpg';



cell color:
where cell needs an identifier :
<td id=id1> Some Text </td>

now we can change it:

(DHTMLEdit1.DOM.all.item('id1', 0) as IHTMLElement).setAttribute('bgcolor', '800080', 0);



to insert a table with cell color:
(from http://members.shaw.ca/iedelphi/ 
 DthtmlEit and TWebbrowser faqs)

var
  insertTableParam: DEInsertTableParam;
  ovInsertTableParam: OleVariant;
begin
  insertTableParam := CreateComObject(Class_DEInsertTableParam) as IDEInsertTableParam;

  insertTableParam.NumRows := 4;
  insertTableParam.NumCols := 3;
  insertTableParam.TableAttrs := 'width=100%';
  insertTableParam.CellAttrs := ' bgColor="blue" noWrap';

  ovInsertTableParam := OleVariant(insertTableParam);
  DHTMLEdit1.ExecCommand(DECMD_INSERTTABLE, OLECMDEXECOPT_DODEFAULT, ovInsertTableParam);
end;

i am subscribed to this group:
http://groups.yahoo.com/group/delphi-dhtmledit/messages

it is specific for the DHtmlEdit so there is alot of tips /code in the archives that may be useful for you.

Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 6990525
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Mdi application Child forms get behind control 7 308
select query - oracle 16 101
JAudiorecorder record freezing the app 29 82
update joined tables 2 62
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question