Solved

DHTMLEdit Property Change

Posted on 2002-05-05
2
523 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now