Solved

DHTMLEdit Property Change

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

831 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