Read Aborted Error when Viewing RTF form

Hey Guys,

I developed a form previewer in clarion which shows a form or displays a form in a small window before opening it into MS Word

My concern is once i load the .RTF Document it starts popping up the error as shown in the screenshot, and this happens only for few documents and not all,

I found a solution on the internet but was only able to get few pieces of information,

Is this a word issue for RTF File or do i need to do anything?

Any help is greatly appreciated,

Attaching screenshot for reference

image

I see no question in your post. Could you elaborate a bit?

Not much information to go on, but I’d assume you’ve got a corruption or a value out of range somewhere

Hi Vedant

you really need to provide much more information, but having said that perhaps this will help if your Word document is corrupt etc

https://support.cch.com/kb/solution/000176973/sw10074

1 Like

Hi @vitesse

I found this solution and it’s working as expected, but still document loading takes almost 15/20 secs, is their any workaround or is it a MS Word issue?

Elaborated in few more words for better understanding

Hey Guys,

I developed a form previewer in clarion which shows a form or displays a form in a small window before opening it into MS Word

My concern is once i load the .RTF Document it starts popping up the error as shown in the screenshot, and this happens only for few documents and not all,

I found a solution on the internet but was only able to get few pieces of information,

Is this a word issue for RTF File or do i need to do anything?

I have multiple word files to view so the solution provided at Knowledge Base Solution - Error: "read aborted / pos:346 control 1 begin group 0 end group 0 word flow major" when adding a custom letter to an Organizer in Production Processing. is not feasible in my case

Any help is greatly appreciated,

Attaching screenshot for reference

image

Sorry for the repost, but i posted this again for better clarity on my previous post

Hi Vedant

I don’t understand why you are starting a new thread. This is likely to get deleted as a duplicate of:

(I think this may have already happened once before)

If you have more information to add, please add it to that earlier thread to keep all the information together in the one place.

If the earlier method using Wordpad is not practical due to a large number of documents then I suggest you do it on a few files and compare the before and after rtf files. You can then see what the differences are and perhaps write some code to automatically do those changes. Remember rtf files are just text files and can be manipulated by your code (did I mention StringTheory?). Just a thought.

Is the USE() variable big enough to hold the contents of this document, or is it dynamically allocated?

@jslarve

This is allocated dynamically, though only large documents are having issues while viewing, word is inserting some blank spaces or characters due to which loading is being slow.

Hey vitesse

Do we have any solution for this RTF issue?

Hi Vedant

it is hard to know when you didn’t say whether you had any success with my earlier suggestion:

if it is still not working, maybe attach a few RTF files before/after the Wordpad fix and show your code to do the desired transformation - assuming you could readily see the differences and were able to have a go at doing the fix programatically.

Assumption: You are able to fix the rtf’s using Wordpad but you want to do it in Clarion code instead. Is that correct?

Yes vitesse, that’s correct,

WordPad solution won’t work as of now, and there are only one or two files/forms that are having the issue while loading,

Might be word is inserting some blank characters which takes time while assembling and this issue has started very recently.

Hi Vedant

it seems I may be misunderstanding you.

I thought you could fix the problems manually by pasting into WordPad and saving but there were too many of the forms so you wanted a fix in code. But now I read there are only one or two files/forms with the problems and for some reason WordPad is not solving the problem.

Perhaps if you can zip up the forms that are failing and post them if they are not too large then I (or someone else) can look and see if we can spot the problem. Also include a screen shot of the exact error message for each form as the Read Aborted message seemed to have some location information (the first field was ‘pos:’). Perhaps there are some invalid characters that you need to remove?

Yes, do you have any idea about any tools or the piece of code which eliminated some extra spaces or words and then assembles the files after removing all the garbage characters,

Yes there are only a few forms that are lengthy and/or inserts some whitespaces into Word file, but long story short, most of the lengthy RTF files take much time and then throws POS error.

Thanks for all the help vitesse, i hope you understood my query now, waiting for your kind response

Hello again Vedant.

The best tool that I know of (and which I always give a free plug to) is StringTheory. I am biased but I think it is the perfect tool for slicing and dicing strings. Clarion comes with SystemString but I do not think it is as good and I am not as familiar with it.

Have a look at the various ST methods:

https://www.capesoft.com/docs/StringTheory3/StringTheory.htm#StringTheoryMethods

for example to remove extra spaces look at Squeeze with the ST:NOPUNCTUATION option.

and to remove “garbage characters” perhaps you could use either KeepChars or RemoveChars.

Perhaps you have UTF8 chars in there and need to do st.toAnsi(st:EncodeUtf8).

Or perhaps there are other characters (or combination of characters) that you need to do replacements on in which case you would use st.Replace…

For example a while ago someone on the newsgroups was having a problem with three “garbage characters” and in that case having seen his data I suggested:

   if ~st.loadFile('.\testdata\Test.in')
     message('Failed to load file' &'||Error: '& st.LastError ,'File not Loaded')
   else
     st.replace('<0E2h,080h,099h>','''') ! single quote
     st.replace('<0E2h,080h,09Dh>','"')  ! double quotes
     st.replace('<0C2h,0B0h>','<0F8h>')  ! degrees
     st.saveFile('.\testdata\test.out')
   end

This is all just general guidance as it is hard to know without seeing your RTF documents, but I hope that helps.