Solved

DHTMLEdit Property Change

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 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