I have been using Ian's RTF print goodie (Thanks Ian!). However I have
recently been debugging an RTF truncation problem. I believe I have tracked it down to a problem using readRtfFrom: on a created but invisible RichTextEdit. Is this a Dolphin bug, MS bug, or a "feature"? The code bellow illustrates the issue. I am running Windows XP SP1. ================= "Make a big test file." testStream := FileStream write: 'C:\ReallyBigRTFTest.rtf' text: true. testStream nextPutAll: '{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} {\colortbl ;\red0\green0\blue0;} \viewkind4\uc1\pard\cf1\lang1033\f0\fs16 '. 50000 timesRepeat: [testStream nextPutAll: 'test']. testStream nextPutAll: 'End \par }'. testStream close. "Open the test file. This works fine." testStream := FileStream read: 'C:\ReallyBigRTFTest.rtf' text: true. rte := RichTextEdit show. rte readRtfFrom: testStream. rtfSize := rte rtfText size. 200172 "Now pass the RTF to another control. This works fine." readWriteStream := ReadWriteStream on: (String new). rte printRtfOn: readWriteStream. readWriteStream reset. readWriteStream contents size = rtfSize ifFalse: [self error: 'Wrong sizes']. readWriteStream reset. "Now read it into an invisible RTE. This truncates the text with no explaination." (rte2 := RichTextEdit new) parentView: View desktop; create; readRtfFrom: readWriteStream; yourself. rte2 rtfText size = rtfSize ifFalse: [self error: 'Wrong size']. "Now read it into a visible RTE. This works fine." readWriteStream reset. rte2 := RichTextEdit show. rte2 readRtfFrom: readWriteStream. rte2 rtfText size = rtfSize ifFalse: [self error: 'Wrong sizes']. ================= Chris |
Chris,
> I have been using Ian's RTF print goodie (Thanks Ian!). Just FYI - I did start rewriting and refactoring all my RichEdit stuff but I'm afraid RealLife (tm) intervened and I can't see me getting back to it any time soon. > However I > have recently been debugging an RTF truncation problem. I believe I > have tracked it down to a problem using readRtfFrom: on a created but > invisible RichTextEdit. Is this a Dolphin bug, MS bug, or a > "feature"? The code bellow illustrates the issue. I am running > Windows XP SP1. It's because you've exceeded the default text limit for the RTE. I seem to recall that Windows can automagically adjust visible RTEs but invisible ones just truncate. Change the problem section as below and you should be OK. (rte2 := RichTextEdit new) parentView: View desktop; create; textLimit: 500000; "********" readRtfFrom: readWriteStream; yourself. rte2 rtfText size = rtfSize ifFalse: [self error: 'Wrong size']. -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
"Ian Bartholomew" <[hidden email]> wrote in message
news:413f6e35$0$93535$[hidden email]... > Chris, > > > I have been using Ian's RTF print goodie (Thanks Ian!). > > Just FYI - I did start rewriting and refactoring all my RichEdit stuff but > I'm afraid RealLife (tm) intervened and I can't see me getting back to it > any time soon. No problem, I totally understand. I just started using the packages you posted here for testing a while ago, with the changes we discussed for page handling. So far it seems like it works well. I really appreciate your efforts. > It's because you've exceeded the default text limit for the RTE. I seem to > recall that Windows can automagically adjust visible RTEs but invisible ones > just truncate. Change the problem section as below and you should be OK. That works perfectly. That was one of the first things I checked too. Apparently I did not check the right value at the right time on the right object. ;) Thanks for the help. Chris |
Free forum by Nabble | Edit this page |