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
Solved

DHTMLEdit Cell Background Image

Posted on 2002-05-06
5
295 Views
Last Modified: 2010-04-04
DHTMLEdit Cell Background Image

How to insert and change cell background image ?

Thanks.
0
Comment
Question by:treqw
  • 3
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 500 total points
ID: 6992767
hi,
you should be able to reference it like this:

(DHTMLEdit1.DOM.all.item('id1', 0) as IHTMLElement).setAttribute('background', 'D:\spawntest.jpg', 0);

where cell has a id of id1
<td id=id1>
and after tag should end up like:
<td id=id1 background=D:\spawntest.jpg>

if you have kpro read this q on same topic for free:
http://www.experts-exchange.com/delphi/Q.20297195.html
0
 

Author Comment

by:treqw
ID: 6993204
If I select object (cell, page, etc...) in DHTMLEdit, I want to recognite selection in text.

Like that :
Selected part of page is :
<td id=id1 background=D:\spawntest.jpg>

Thanks.
0
 

Author Comment

by:treqw
ID: 6993222
And when I find selected part in DHTMLEdit I want to do change. I'm doing that with ID, or some other way ?

Thanks.
0
 
LVL 17

Expert Comment

by:inthe
ID: 6995420
hi,
just ignore ReplaceInfo(St);
it is someones private function and unless they tell you it you never know.
i dont know what they were trying to do but it looks like all you need to do to replace the text is to :
do it like:
 

var
HTMLDoc : IHTMLDocument2;
Selection : IHTMLSelectionObject;
TextRange : IHTMLTxtRange;
St : String;
begin
HTMLDoc := DHTMLEdit1.DOM as IHTMLDocument2;
Selection := HTMLDoc.Selection as IHTMLSelectionObject;
if Selection.type_ = 'Text' then
begin
TextRange := Selection.CreateRange as IHTMLTxtRange;
St := DHTMLEdit1.FilterSourceCode(TextRange.htmlText);
St := 'hello';
TextRange.pasteHTML(St);
end;
end;

0
 
LVL 17

Expert Comment

by:inthe
ID: 6995425
if you want to know what the text is thats is being replaced st contains it here:

<snip>
St := DHTMLEdit1.FilterSourceCode(TextRange.htmlText);
showmessage(st); //current selected text
St := 'hello'; //now change it
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…

809 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