473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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\ansicpg1252\deff0\deflang1033{\fonttbl {\f0\fnil\fcharset0 MS
Sans Serif;}}
\viewkind4\uc1\pard\f0\fs17 test

It is so stupid!
Mel,
Montreal
Nov 13 '05 #1
4 4319
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(Amount = 20
reduces to approximately 20% of original)

NO GUARANTEES

Function ChangeRTFFontSize(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(RTFIn, 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(RTFIn, i + 3,
NumCount)) * Amount \ 100)
LengthChange = LengthChange + Len(TempStgOut) - Len(TempStgIn)
' Is it shorter or longer
TempStg = TempStg & Mid(Replace(RTFIn, 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

ChangeRTFFontSize = TempStg

End Function

"Mel" <mb******@NOSPAMcae.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\ansicpg1252\deff0\deflang1033{\fonttbl {\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********@stantonfamily.co.uk> wrote in message
news:41***********************@mercury.nildram.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(Amount = 20 reduces to approximately 20% of original)

NO GUARANTEES

Function ChangeRTFFontSize(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(RTFIn, 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(RTFIn, i + 3,
NumCount)) * Amount \ 100)
LengthChange = LengthChange + Len(TempStgOut) - Len(TempStgIn)
' Is it shorter or longer
TempStg = TempStg & Mid(Replace(RTFIn, 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

ChangeRTFFontSize = TempStg

End Function

"Mel" <mb******@NOSPAMcae.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\ansicpg1252\deff0\deflang1033{\fonttbl {\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******@NOSPAMcae.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********@stantonfamily.co.uk> wrote in message
news:41***********************@mercury.nildram.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(Amount = 20
reduces to approximately 20% of original)

NO GUARANTEES

Function ChangeRTFFontSize(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(RTFIn, 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(RTFIn, i +
3, NumCount)) * Amount \ 100)
LengthChange = LengthChange + Len(TempStgOut) - Len(TempStgIn) ' Is it shorter or longer
TempStg = TempStg & Mid(Replace(RTFIn, 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

ChangeRTFFontSize = TempStg

End Function

"Mel" <mb******@NOSPAMcae.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\ansicpg1252\deff0\deflang1033{\fonttbl {\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******@NOSPAMcae.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\ansicpg1252\deff0\deflang1033{\fonttb l{\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
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
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...
6
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:...
2
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...
0
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...
4
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...
1
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...
1
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...
2
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),...
11
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.