Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Kris
  Where is Kris?
 Chicago
 Illinois - United States
 Kris
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
Subject: RE: How to modify text in Richtext Activex?
Thread ID: 471019 Message ID: 471026 # Views: 56 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Active X Controls & OLE Automation
Date: Tuesday, December 31, 2019 2:11:45 PM         
   



Izmir... thats exactly what I was loking for. Thank you SO MUCH!!

K Doc


> > Hi,
> >
> > I was wondering if anyone knew how to modify text in a Richtext OLE Activex control within a VFP form? I want to be able to search for '***' within the Richtext OLE and then replace this with a specific phrase. I was able to do it easily with the VFP Textbox (which does not have any formatting.) However, I am not sure how to grab the text from RichText OLE and modify it given the actual data for the Richtext OLE has formatting codes for fonts, etc.
> >
> > Any help would be appreciated
> >
> > K Doc
>
> Probably you mean to keep formatting while replacing. You can use RichTextBox's PEM to do that. ie:
>
>
> Text to rtfTestText noshow
> {\rtf1\<font color="Blue">ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fnil\fcharset0 Arial;}} {\colortbl ;\red51\green51\blue51;\red0\green128\blue64;} \viewkind4\uc1\pard\sl-280\slmult0\cf1\lang16393\ul\f0\fs18 those who need our redoubt \par \ulnone RTFTest and time test line , in orchid to m\b ake thicket world as beautiful stab o\i urs. RTFTEST Here is an test line search oppo\i0 rtu\b0 nity to do so. \par \par \pard We are celebrating the \b\i Joy of Giving\b0\i0 \b\i Week\b0\i0 at SunGard from October 3-\cf2\b\i 7, 2011 in Pune. You can share in the joy of helping those less fortunate than us by participating in our collection drive. Donate clothes, grocery coupo\cf1\b0\i0 ns, newspapers or cash, and these will be given to NGO, RTFTest\cf0\lang1033\f1\fs17 \par [10/07/2011 19:00, SA, HPP] \fs18 \par [10/07/2011 19:01, SA, HPP] \b this is a end line entry\b0 \par [10/09/2011 12:44, SA, HPP] \cf1\lang16393\f0 roses and timmme, in orchid to m\b ake test world as beautiful test o\i urs. TWEAKED Here is an test line search oppo\i0 rtu\b0 nity to do \cf0\lang1033\f1 \par [10/09/2011 12:52, SA, HPP] \cf1\lang16393\f0 roses and time, in order to m\b ake test world as beautiful test o\i urs. TEST Here change\cf0\lang1033\b0\i0\f1 \par }
> EndText
> 
> lcSearch = "2011"
> lcReplace= "[replaced with 2012]"
> Public  oShowRTF
> oShowRTF = Createobject("frmShowRTF")
> oShowRTF.Show()
> 
> With oShowRTF.myRTF
>   .TextRTF = m.rtfTestText
> 
>   lnPos = .Find(m.lcSearch)
>   lnFirst = m.lnPos
>   Do While m.lnPos > -1
>     .SelColor = Rgb(255,0,0) && color it red
>     .SelText = m.lcReplace
>     lnPos = .Find(m.lcSearch,m.lnPos + Len(m.lcSearch))
>   Enddo
>   .SelStart = 0 && Len(m.tcText)
>   .SelStart = m.lnFirst && Locate before first one
> 
> Endwith
> 
> Define Class frmShowRTF As Form
>   Height  		= 250
>   Width   		= 300
>   Add Object myRTF As OleControl With ;
>     OleClass = "RICHTEXT.RichTextCtrl.1", Height=250,Width=300,Anchor=15
> Enddefine
> 

>
> PS: Code is very old (2012?), I don't remember where I did get that weird text for sampling.
>
>

> Cetin Basoz
>
> Give some sample data in code for your question - here is the tool you need to generate the code
>
> My Blog
>

> PostgreSQL - World's most advanced open source database

> MongoDb Certified Developer
> MongoDb Certified DBA
>

> Support Wikipedia
>
>
Flutter for mobile, for web & desktop.
>
The way to Go.
>
How to create a Minimal, Reproducible Example

ENTIRE THREAD

How to modify text in Richtext Activex? Posted by k doc @ 12/31/2019 2:05:01 AM
RE: How to modify text in Richtext Activex? Posted by Jun Tangunan @ 12/31/2019 2:45:36 AM
RE: How to modify text in Richtext Activex? Posted by Cetin Basoz @ 12/31/2019 1:24:30 PM
RE: How to modify text in Richtext Activex? Posted by k doc @ 12/31/2019 2:11:45 PM
RE: How to modify text in Richtext Activex? Posted by Cetin Basoz @ 1/1/2020 10:33:45 PM
RE: How to modify text in Richtext Activex? Posted by Benny Thomas @ 1/2/2020 10:49:25 AM
RE: How to modify text in Richtext Activex? Posted by Benny Thomas @ 1/2/2020 10:53:28 AM