473,721 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP: Problem with rich text box

Mel
Hi,

When you use a RichText box (I'm using Microsoft Control VB 6.0, OLE
Class: RichtextCtrl)
It is possible to store only the text in the table instead of the rft
format?
The problem is when you generate the report, it takes data from tables that
now have all the RFT format code, like the following:
{\rtf1\ansi\ans icpg1252\deff0\ deflang1033{\fo nttbl{\f0\fnil\ fcharset0 MS
Sans Serif;}}
\viewkind4\uc1\ pard\f0\fs17 test

It is so stupid!
Mel,
Montreal
Nov 13 '05 #1
4 4350
I don't know if this is any help, but I had a similar problem using Stephen
Leban's RTF2 Control

I still wanted the report to have an RTF control, but a different size font.
This function reduces (increases) the font by a fixed percentage(Amou nt = 20
reduces to approximately 20% of original)

NO GUARANTEES

Function ChangeRTFFontSi ze(RTFIn As String, Amount As Integer) As String

Dim TempStg As String, TempStgIn As String, TempStgOut As String
Dim i As Integer, j As Integer, k As Integer
Dim NumCount As Integer ' numeric count
Dim LengthChange As Integer ' lengthened or
shortened
Dim LengthShort As Integer

For i = 1 To Len(RTFIn)
i = InStr(i, RTFIn, "\fs") ' Find font size
setting
If i > 0 Then
NumCount = 0
For k = i + 3 To i + 6
If IsNumeric(Mid(R TFIn, k, 1)) Then
NumCount = NumCount + 1 ' How
many numbers
End If
Next k
TempStgIn = Mid(RTFIn, i, NumCount + 3) ' the 4,
5 or 6 figures
' Reduce the font size by amount percentage
TempStgOut = Mid(RTFIn, i, 3) & CStr(CInt(Mid(R TFIn, i + 3,
NumCount)) * Amount \ 100)
LengthChange = LengthChange + Len(TempStgOut) - Len(TempStgIn)
' Is it shorter or longer
TempStg = TempStg & Mid(Replace(RTF In, TempStgIn, TempStgOut, ,
, vbTextCompare), j + 1, i + 3 + NumCount - j)
End If

If i <= j Then Exit For
j = i + 3 + NumCount ' move along
4, 5 or 6 letters
Next

LengthShort = Len(RTFIn) - Len(TempStg) + LengthChange
If LengthShort <> 0 Then
TempStg = TempStg & Right(RTFIn, LengthShort) ' missing
bits at end
End If

ChangeRTFFontSi ze = TempStg

End Function

"Mel" <mb******@NOSPA Mcae.com> wrote in message
news:cr******** **@dns3.cae.ca. ..
Hi,

When you use a RichText box (I'm using Microsoft Control VB 6.0, OLE
Class: RichtextCtrl)
It is possible to store only the text in the table instead of the rft
format?
The problem is when you generate the report, it takes data from tables
that
now have all the RFT format code, like the following:
{\rtf1\ansi\ans icpg1252\deff0\ deflang1033{\fo nttbl{\f0\fnil\ fcharset0 MS
Sans Serif;}}
\viewkind4\uc1\ pard\f0\fs17 test

It is so stupid!
Mel,
Montreal

Nov 13 '05 #2
Mel
Thank you but I only need to display the text without any formating on the
report.
the RichText control store all the RFT code in the tables, I want it to act
a bit like a TextBox.

"Phil Stanton" <di********@sta ntonfamily.co.u k> wrote in message
news:41******** *************** @mercury.nildra m.net...
I don't know if this is any help, but I had a similar problem using Stephen Leban's RTF2 Control

I still wanted the report to have an RTF control, but a different size font. This function reduces (increases) the font by a fixed percentage(Amou nt = 20 reduces to approximately 20% of original)

NO GUARANTEES

Function ChangeRTFFontSi ze(RTFIn As String, Amount As Integer) As String

Dim TempStg As String, TempStgIn As String, TempStgOut As String
Dim i As Integer, j As Integer, k As Integer
Dim NumCount As Integer ' numeric count
Dim LengthChange As Integer ' lengthened or
shortened
Dim LengthShort As Integer

For i = 1 To Len(RTFIn)
i = InStr(i, RTFIn, "\fs") ' Find font size
setting
If i > 0 Then
NumCount = 0
For k = i + 3 To i + 6
If IsNumeric(Mid(R TFIn, k, 1)) Then
NumCount = NumCount + 1 ' How many numbers
End If
Next k
TempStgIn = Mid(RTFIn, i, NumCount + 3) ' the 4, 5 or 6 figures
' Reduce the font size by amount percentage
TempStgOut = Mid(RTFIn, i, 3) & CStr(CInt(Mid(R TFIn, i + 3,
NumCount)) * Amount \ 100)
LengthChange = LengthChange + Len(TempStgOut) - Len(TempStgIn)
' Is it shorter or longer
TempStg = TempStg & Mid(Replace(RTF In, TempStgIn, TempStgOut, , , vbTextCompare), j + 1, i + 3 + NumCount - j)
End If

If i <= j Then Exit For
j = i + 3 + NumCount ' move along 4, 5 or 6 letters
Next

LengthShort = Len(RTFIn) - Len(TempStg) + LengthChange
If LengthShort <> 0 Then
TempStg = TempStg & Right(RTFIn, LengthShort) ' missing
bits at end
End If

ChangeRTFFontSi ze = TempStg

End Function

"Mel" <mb******@NOSPA Mcae.com> wrote in message
news:cr******** **@dns3.cae.ca. ..
Hi,

When you use a RichText box (I'm using Microsoft Control VB 6.0, OLE
Class: RichtextCtrl)
It is possible to store only the text in the table instead of the rft
format?
The problem is when you generate the report, it takes data from tables
that
now have all the RFT format code, like the following:
{\rtf1\ansi\ans icpg1252\deff0\ deflang1033{\fo nttbl{\f0\fnil\ fcharset0 MS
Sans Serif;}}
\viewkind4\uc1\ pard\f0\fs17 test

It is so stupid!
Mel,
Montreal


Nov 13 '05 #3
The RTF control has a Text property. Create and Unbound TextBox control
and set its Value property ot the Text property of a hidden/invisible
RTF control.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Mel" <mb******@NOSPA Mcae.com> wrote in message
news:cr******** **@dns3.cae.ca. ..
Thank you but I only need to display the text without any formating on the report.
the RichText control store all the RFT code in the tables, I want it to act a bit like a TextBox.

"Phil Stanton" <di********@sta ntonfamily.co.u k> wrote in message
news:41******** *************** @mercury.nildra m.net...
I don't know if this is any help, but I had a similar problem using Stephen
Leban's RTF2 Control

I still wanted the report to have an RTF control, but a different size font.
This function reduces (increases) the font by a fixed
percentage(Amou nt = 20
reduces to approximately 20% of original)

NO GUARANTEES

Function ChangeRTFFontSi ze(RTFIn As String, Amount As Integer) As
String
Dim TempStg As String, TempStgIn As String, TempStgOut As String
Dim i As Integer, j As Integer, k As Integer
Dim NumCount As Integer ' numeric count Dim LengthChange As Integer ' lengthened or shortened
Dim LengthShort As Integer

For i = 1 To Len(RTFIn)
i = InStr(i, RTFIn, "\fs") ' Find font size setting
If i > 0 Then
NumCount = 0
For k = i + 3 To i + 6
If IsNumeric(Mid(R TFIn, k, 1)) Then
NumCount = NumCount + 1 ' How
many numbers
End If
Next k
TempStgIn = Mid(RTFIn, i, NumCount + 3) '
the 4,
5 or 6 figures
' Reduce the font size by amount percentage
TempStgOut = Mid(RTFIn, i, 3) & CStr(CInt(Mid(R TFIn, i +
3, NumCount)) * Amount \ 100)
LengthChange = LengthChange + Len(TempStgOut) - Len(TempStgIn) ' Is it shorter or longer
TempStg = TempStg & Mid(Replace(RTF In, TempStgIn, TempStgOut, ,
, vbTextCompare), j + 1, i + 3 + NumCount - j)
End If

If i <= j Then Exit For
j = i + 3 + NumCount '
move along
4, 5 or 6 letters
Next

LengthShort = Len(RTFIn) - Len(TempStg) + LengthChange
If LengthShort <> 0 Then
TempStg = TempStg & Right(RTFIn, LengthShort) '

missing bits at end
End If

ChangeRTFFontSi ze = TempStg

End Function

"Mel" <mb******@NOSPA Mcae.com> wrote in message
news:cr******** **@dns3.cae.ca. ..
Hi,

When you use a RichText box (I'm using Microsoft Control VB 6.0, OLE Class: RichtextCtrl)
It is possible to store only the text in the table instead of the rft format?
The problem is when you generate the report, it takes data from tables that
now have all the RFT format code, like the following:
{\rtf1\ansi\ans icpg1252\deff0\ deflang1033{\fo nttbl{\f0\fnil\ fcharset0 MS Sans Serif;}}
\viewkind4\uc1\ pard\f0\fs17 test

It is so stupid!
Mel,
Montreal




Nov 13 '05 #4
On Wed, 5 Jan 2005 09:38:01 -0500, "Mel" <mb******@NOSPA Mcae.com>
wrote:
Hi,

When you use a RichText box (I'm using Microsoft Control VB 6.0, OLE
Class: RichtextCtrl)
It is possible to store only the text in the table instead of the rft
format?
The problem is when you generate the report, it takes data from tables that
now have all the RFT format code, like the following:
{\rtf1\ansi\an sicpg1252\deff0 \deflang1033{\f onttbl{\f0\fnil \fcharset0 MS
Sans Serif;}}
\viewkind4\uc1 \pard\f0\fs17 test

It is so stupid!
Mel,
Montreal

Hi
Doesn't the control have a Text property? The .NET one has. You can
use this maybe to store a text-only version of the field in another
column in the table.
David

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2460
by: Frank Gewalt | last post by:
Hi My problem is that unicode fonts like cyrillic fonts are not shown correctly in combo boxes with Windows 98. I'm using 'MS Sans Serif' and 'Tahoma' fonts. Has somebody a solution for that?
5
1625
by: DigitalGENOcyde | last post by:
I am fairly new to working with programming so pardon my lack of knowledge, but I was hoping someone could assist me with working on a project. I am trying to make a Windows application using Visual Basic 2005 Express, and am wanting to have a menu bar with one of the drop downs being similar to that of the "Edit" drop down in most any other Windows app. I am wanting to find the code to perform such functions as Cutting, Copying and...
6
2326
by: cj | last post by:
Lets just take this example I'm looking at now. I'm looking at the help screen titled .NET Framework Class Library FolderBrowserDialog Class . It gives an example at the bottom that begins with: ' The following example displays an application that provides the ability to ' open rich text files (rtf) into the RichTextBox. The example demonstrates ' using the FolderBrowserDialog to set the default directory for opening files. ' The...
2
1576
by: MLH | last post by:
I did these 4 steps to create a topic file 1 Open a new file in a word processor or text editor that can handle rich text format. 2 Write your individual topics, separating each topic with a hard page break. 3 Add appropriate footnotes at the beginning of the file. See Related Topics below. 4 Save the file in rich text format with the .rtf filename
0
5571
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
4
5482
by: Neil | last post by:
Just found out that the Microsoft Rich Textbox does not support full text justification, since it's based on Version 1.0 of the RichEdit Window Class, and full text justification is only available in versions 3.0 or later of the class. However, also just found out that the new Rich Text property in Access 2007 ALSO does not support full text justification! This seems incredible, that MS would create a brand new application, and not...
1
1603
by: tvance929 | last post by:
Can someone tell me, is there a way to format the text within the coding side of the rich text box? In other words, when someone clicks a button I send a message to a rich text box. In that String that I send to the box, I would like to have some of the words BOLD and some underlined. Can someone clue me in on how to do this? DO I EVEN need a rich text box for this function? ALSO - is there a way to get a scroll bar in this control if...
1
1703
by: lnong | last post by:
Im using the ActivePDF Toolkit to programmatically fill in a PDF document using .NET. I have a mulitline textfield (textbox), and I want to be able to insert a newline character. I cannot find a way to do this. I tried outputting these, but none work. Please help! 1) "This is Line 1" + "\n" + "This is Line 2" 2) "This is Line 1" + Environment.NewLine + "This is Line 2" 3) "This is Line 1" + ControlChars.CrLf + "This is Line 2" 4)...
2
5485
by: tristanlbailey | last post by:
I been scouring the Internet for an answer to my problem, and a couple of times thought I had almost found the answer, but still to no avail. I'm tying to use the Rich Edit class (riched20.dll), to display unicode text. The riched20.dll file is loaded by using the LoadLibrary function, and a Rich Edit control created with the CreateWindowEx function. The text is input into a string variable from a unicode text file. The text is then inserted...
11
12078
by: ARC | last post by:
Hello all, My app has an e-mailing feature where you can e-mail reports, as well as a bulk e-mail feature for e-mailing all customers (as separate e-mails). I allow the user to set the subject text, body text, and browse for attachments. I also allow 3 basic e-mailing options: Default mail handler (Mapi), MS Outlook, and a proprietary e-mailing client. I've always been curious how you would send rich text in the body message, or...
0
8731
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9370
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9132
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9067
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8009
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5986
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4487
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4755
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2132
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.