sachin75
September 28th, 2001, 01:34 AM
I have a RTF file which i want to load in a RTF control & display.
While loading a file I want to insert a header & footer in the RTF file. Since contents of header & footer are not fix, i have to do it at run time. How o I do that ? Has anybody worked on the same ?
-Sachin
Cimperiali
September 28th, 2001, 02:29 AM
private Sub Command1_Click()
'now choose: or you save the file with all
'and then you must code to search for your header or your footer and if exist on reloading
'do not add it again, or you save the
'file stripping headre and footer.
'Here I show you the first one
Const myHeader = "This is my Header"
Const myFooter = "This is my footerNote"
'load the file
rtfBox.FileName = "D:\pota.rtf"
If rtfBox.Find(myHeader, 0, , rtfWholeWord) = -1 then
rtfBox.SelStart = len(rtfBox.Text)
rtfBox.SelLength = 0
rtfBox.SelText = vbCrLf & vbCrLf & myFooter
rtfBox.SelStart = 0
rtfBox.SelLength = 0
rtfBox.SelText = myHeader & vbCrLf & vbCrLf
End If
rtfBox.SaveFile "D:\pota.rtf", rtfRTF
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater