Solved

DHTMLEdit Property Change

Posted on 2002-05-05
2
536 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 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