A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Convert text to RTF2



 
 
Thread Tools Display Modes
  #1  
Old August 3rd, 2006, 03:34 PM posted to microsoft.public.access.forms
A.C.
external usenet poster
 
Posts: 21
Default Convert text to RTF2

hi,

i have a table with many record and i want to convert my memo (txt) in memo
rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro


  #2  
Old August 4th, 2006, 04:07 PM posted to microsoft.public.access.forms
Stephen Lebans
external usenet poster
 
Posts: 619
Default Convert text to RTF2

Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt) in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro



  #3  
Old August 4th, 2006, 05:15 PM posted to microsoft.public.access.forms
A.C.
external usenet poster
 
Posts: 21
Default Convert text to RTF2

i have read in the newsgroup the post from "Disable right-click menu for
RTF2 " by Bogdan Zamfir
Where is the solutions?

Thank you.
alessandro

this is the code to convert text in rtf:

Sub CmdRTF()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
Dim db As Database, rs As Recordset

Set db = CodeDb()
Set rs = db.OpenRecordset("Stampati", DB_OPEN_DYNASET)


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttb l{\f0\fnil\fcharset0
Courier New;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20"


With rs
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("s_testo")), "", .Fields("s_testo"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("s_testo") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



"Stephen Lebans"
ha scritto nel messaggio ...
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt) in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro





  #4  
Old August 8th, 2006, 02:49 AM posted to microsoft.public.access.forms
Stephen Lebans
external usenet poster
 
Posts: 619
Default Convert text to RTF2

Opne the table with the Memo field that contains the RTF data. Copy and
paste one of the records here that fails to display properly.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
i have read in the newsgroup the post from "Disable right-click menu for
RTF2 " by Bogdan Zamfir
Where is the solutions?

Thank you.
alessandro

this is the code to convert text in rtf:

Sub CmdRTF()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
Dim db As Database, rs As Recordset

Set db = CodeDb()
Set rs = db.OpenRecordset("Stampati", DB_OPEN_DYNASET)


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttb l{\f0\fnil\fcharset0
Courier New;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20"


With rs
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("s_testo")), "", .Fields("s_testo"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("s_testo") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



"Stephen Lebans"
ha scritto nel messaggio ...
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt) in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro







  #5  
Old August 8th, 2006, 01:29 PM posted to microsoft.public.access.forms
A.C.
external usenet poster
 
Posts: 21
Default Convert text to RTF2

this is the field after conversion:
Pistoia, 30 aprile 2002A richiesta dell'interessato si certifica che il
canedi nome LALLArazza YORK SHIRE TERRIERnato in Feb. 2001sesso Fmantello
nero focatodi proprieta' del Sig. ANTONIO VALLORSIresidente a PESARO in via
VIA PASTRENGO 8presenta alla grassella destra il seguente tatuaggio 2REA465.
TIMBRO E FIRMA



this is the field original:






Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA

the original font is Courier New 10 pt.

this is the rtf field:

{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl {\f0\fnil\fcharset0
Courier New;}}{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20




Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA\par }



"Stephen Lebans"
ha scritto nel messaggio ...
Opne the table with the Memo field that contains the RTF data. Copy and
paste one of the records here that fails to display properly.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
i have read in the newsgroup the post from "Disable right-click menu for
RTF2 " by Bogdan Zamfir
Where is the solutions?

Thank you.
alessandro

this is the code to convert text in rtf:

Sub CmdRTF()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
Dim db As Database, rs As Recordset

Set db = CodeDb()
Set rs = db.OpenRecordset("Stampati", DB_OPEN_DYNASET)


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttb l{\f0\fnil\fcharset0
Courier New;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20"


With rs
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("s_testo")), "",
.Fields("s_testo"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("s_testo") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



"Stephen Lebans"
ha scritto nel
messaggio ...
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt) in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro










  #6  
Old August 8th, 2006, 01:30 PM posted to microsoft.public.access.forms
A.C.
external usenet poster
 
Posts: 21
Default Convert text to RTF2

this is the field after conversion:
Pistoia, 30 aprile 2002A richiesta dell'interessato si certifica che il
canedi nome LALLArazza YORK SHIRE TERRIERnato in Feb. 2001sesso Fmantello
nero focatodi proprieta' del Sig. ANTONIO VALLORSIresidente a PESARO in via
VIA PASTRENGO 8presenta alla grassella destra il seguente tatuaggio 2REA465.
TIMBRO E FIRMA



this is the field original:






Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA

the original font is Courier New 10 pt.

this is the rtf field:

{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl {\f0\fnil\fcharset0
Courier New;}}{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20




Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA\par }



"Stephen Lebans"
ha scritto nel messaggio ...
Opne the table with the Memo field that contains the RTF data. Copy and
paste one of the records here that fails to display properly.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
i have read in the newsgroup the post from "Disable right-click menu for
RTF2 " by Bogdan Zamfir
Where is the solutions?

Thank you.
alessandro

this is the code to convert text in rtf:

Sub CmdRTF()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
Dim db As Database, rs As Recordset

Set db = CodeDb()
Set rs = db.OpenRecordset("Stampati", DB_OPEN_DYNASET)


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttb l{\f0\fnil\fcharset0
Courier New;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20"


With rs
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("s_testo")), "",
.Fields("s_testo"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("s_testo") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



"Stephen Lebans"
ha scritto nel
messaggio ...
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt) in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro











  #7  
Old August 8th, 2006, 01:30 PM posted to microsoft.public.access.forms
A.C.
external usenet poster
 
Posts: 21
Default Convert text to RTF2

this is the field after conversion:
Pistoia, 30 aprile 2002A richiesta dell'interessato si certifica che il
canedi nome LALLArazza YORK SHIRE TERRIERnato in Feb. 2001sesso Fmantello
nero focatodi proprieta' del Sig. ANTONIO VALLORSIresidente a PESARO in via
VIA PASTRENGO 8presenta alla grassella destra il seguente tatuaggio 2REA465.
TIMBRO E FIRMA



this is the field original:






Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA

the original font is Courier New 10 pt.

this is the rtf field:

{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl {\f0\fnil\fcharset0
Courier New;}}{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20




Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA\par }



"Stephen Lebans"
ha scritto nel messaggio ...
Opne the table with the Memo field that contains the RTF data. Copy and
paste one of the records here that fails to display properly.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
i have read in the newsgroup the post from "Disable right-click menu for
RTF2 " by Bogdan Zamfir
Where is the solutions?

Thank you.
alessandro

this is the code to convert text in rtf:

Sub CmdRTF()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
Dim db As Database, rs As Recordset

Set db = CodeDb()
Set rs = db.OpenRecordset("Stampati", DB_OPEN_DYNASET)


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttb l{\f0\fnil\fcharset0
Courier New;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20"


With rs
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("s_testo")), "",
.Fields("s_testo"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("s_testo") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



"Stephen Lebans"
ha scritto nel
messaggio ...
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt) in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro











  #8  
Old August 12th, 2006, 04:47 AM posted to microsoft.public.access.forms
Stephen Lebans
external usenet poster
 
Posts: 619
Default Convert text to RTF2

Your RTF Header is not correct.

The RTF control can only display RTF encoded text. If you want to simply
display plain text then wrap your plain text within the required RTF
encoding.


Here's a previous post of mine on a related issue.
http://groups.google.ca/group/micros...orms/browse_fr...


From: Stephen Lebans - view profile
Date: Tues, Feb 14 2006 9:30 pm
Email: "Stephen Lebans"

Groups: microsoft.public.access.forms
Not yet ratedRating:
show options


Reply to Author | Forward | Print | Individual Message | Show original
| Report Abuse | Find messages by this author


Let me know how you make out.


Make sure your Form has:
A TextBox control named txtComment bound to the Comment field(just o you can
see the RTF encoding)
an RTF2 control bound to the Comment field
A CommandButton named cmdRTF


In your References, make sure the ref to DAO is higher in the list than ADO.


Place this code behind the Command Button.


Private Sub CmdRTF_Click()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttb l{\f0\fnil\fcharset0
Arial;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\fs24"


' I could have shortened the code but I wanted you(and others I refer to
this posting) to see what is happening at every step.


With Me.RecordsetClone
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("Comment")), "", .Fields("Comment"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("Comment") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
this is the field after conversion:
Pistoia, 30 aprile 2002A richiesta dell'interessato si certifica che il
canedi nome LALLArazza YORK SHIRE TERRIERnato in Feb. 2001sesso Fmantello
nero focatodi proprieta' del Sig. ANTONIO VALLORSIresidente a PESARO in
via
VIA PASTRENGO 8presenta alla grassella destra il seguente tatuaggio
2REA465.
TIMBRO E FIRMA



this is the field original:






Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA

the original font is Courier New 10 pt.

this is the rtf field:

{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl {\f0\fnil\fcharset0
Courier New;}}{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20




Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA\par }



"Stephen Lebans"
ha scritto nel messaggio ...
Opne the table with the Memo field that contains the RTF data. Copy and
paste one of the records here that fails to display properly.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
i have read in the newsgroup the post from "Disable right-click menu for
RTF2 " by Bogdan Zamfir
Where is the solutions?

Thank you.
alessandro

this is the code to convert text in rtf:

Sub CmdRTF()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
Dim db As Database, rs As Recordset

Set db = CodeDb()
Set rs = db.OpenRecordset("Stampati", DB_OPEN_DYNASET)


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttb l{\f0\fnil\fcharset0
Courier New;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20"


With rs
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("s_testo")), "",
.Fields("s_testo"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("s_testo") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



"Stephen Lebans"
ha scritto nel
messaggio ...
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt) in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is
a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro













  #9  
Old August 17th, 2006, 02:29 PM posted to microsoft.public.access.forms
A.C.
external usenet poster
 
Posts: 21
Default Convert text to RTF2

i have made a program that translate text code in RTF and know the vbcr
code.

thank you
alessandro
"Stephen Lebans"
ha scritto nel messaggio ...
Your RTF Header is not correct.

The RTF control can only display RTF encoded text. If you want to simply
display plain text then wrap your plain text within the required RTF
encoding.


Here's a previous post of mine on a related issue.
http://groups.google.ca/group/micros...orms/browse_fr...


From: Stephen Lebans - view profile
Date: Tues, Feb 14 2006 9:30 pm
Email: "Stephen Lebans"

Groups: microsoft.public.access.forms
Not yet ratedRating:
show options


Reply to Author | Forward | Print | Individual Message | Show
original
| Report Abuse | Find messages by this author


Let me know how you make out.


Make sure your Form has:
A TextBox control named txtComment bound to the Comment field(just o you
can
see the RTF encoding)
an RTF2 control bound to the Comment field
A CommandButton named cmdRTF


In your References, make sure the ref to DAO is higher in the list than
ADO.


Place this code behind the Command Button.


Private Sub CmdRTF_Click()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttb l{\f0\fnil\fcharset0
Arial;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\fs24"


' I could have shortened the code but I wanted you(and others I refer to
this posting) to see what is happening at every step.


With Me.RecordsetClone
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("Comment")), "", .Fields("Comment"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("Comment") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
this is the field after conversion:
Pistoia, 30 aprile 2002A richiesta dell'interessato si certifica che il
canedi nome LALLArazza YORK SHIRE TERRIERnato in Feb. 2001sesso Fmantello
nero focatodi proprieta' del Sig. ANTONIO VALLORSIresidente a PESARO in
via
VIA PASTRENGO 8presenta alla grassella destra il seguente tatuaggio
2REA465.
TIMBRO E FIRMA



this is the field original:






Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA

the original font is Courier New 10 pt.

this is the rtf field:

{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl {\f0\fnil\fcharset0
Courier New;}}{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20




Pistoia, 30 aprile 2002




A richiesta dell'interessato si certifica che il cane

di nome LALLA

razza YORK SHIRE TERRIER

nato in Feb. 2001

sesso F

mantello nero focato

di proprieta' del Sig. ANTONIO VALLORSI

residente a PESARO

in via VIA PASTRENGO 8

presenta alla grassella destra il seguente tatuaggio 2REA465.




TIMBRO E FIRMA\par }



"Stephen Lebans"

ha scritto nel messaggio ...
Opne the table with the Memo field that contains the RTF data. Copy and
paste one of the records here that fails to display properly.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
i have read in the newsgroup the post from "Disable right-click menu for
RTF2 " by Bogdan Zamfir
Where is the solutions?

Thank you.
alessandro

this is the code to convert text in rtf:

Sub CmdRTF()
On Error GoTo Err_CmdRTF_Click


Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
Dim db As Database, rs As Recordset

Set db = CodeDb()
Set rs = db.OpenRecordset("Stampati", DB_OPEN_DYNASET)


sHeader =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttb l{\f0\fnil\fcharset0
Courier New;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\blue0;}\viewkind4\uc1\pard\cf1\f0\fs 20"


With rs
' Move to first record
.MoveFirst


' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fields("s_testo")), "",
.Fields("s_testo"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If


' Save our RTF encoded string back to Comment field
.Fields("s_testo") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop


End With


Exit_CmdRTF_Click:
Exit Sub


Err_CmdRTF_Click:
MsgBox Err.Description
Resume Exit_CmdRTF_Click


End Sub



"Stephen Lebans"
ha scritto
nel
messaggio ...
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"A.C." wrote in message
...
hi,

i have a table with many record and i want to convert my memo (txt)
in
memo rtf2.
I have also used the sub CmdRTF_Click post in newsgroup, but there is
a
problem:
i see the text, but it isn't formatted. All the CRLF are exclused.

Is there anyone to help me?

Thank you
alessandro















 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.