longtrails Posted August 1, 2013 Share Posted August 1, 2013 I'm trying to create a header with page numbering in an RTF file. Using a text editor I can enter '{header Page chpgn}' and get my page numbering. If I use _GUICtrlRichEdit_AppendText to add it characters are escaped and it is displayed as simple text (which makes sense). Looking at the source for _GUICtrlRichEdit_AppendText and the ReadBmpToRtf example I tried enclosing that with '{rtf }' or '{rtf1 }' but nothing gets written to the RTF file and @error is 0 coming out of _SendMessage. I'm a bit stumped. Link to comment Share on other sites More sharing options...
Spiff59 Posted August 2, 2013 Share Posted August 2, 2013 (edited) Welcome to the forum This borders upon being brute-force, but works: $sFileName = @ScriptDir & "\test.rtf" $sData = FileRead($sFileName) $sData = StringReplace($sData, "\pard", "{\header Page \pard\qr\chpgn\par}\pard", 1) $hFile = FileOpen($sFileName, 2) FileWrite($hFile, $sData) FileClose($hFile) Edited August 2, 2013 by Spiff59 Link to comment Share on other sites More sharing options...
longtrails Posted August 2, 2013 Author Share Posted August 2, 2013 (edited) Thank you for the welcome and for the snippet of magic. I am still at a loss as to how the ReadBmpToRtf example found in the AutoIt help will work but my approach won't but your brute-force approach is better than a punch in the mouth! Edited August 2, 2013 by longtrails Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now