469,364 Members | 2,398 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,364 developers. It's quick & easy.

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 4135
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by ARC | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.