Saving Australian and other non-US English as RTF

General TRichView support forum. Please post your questions here
Post Reply
rjking
Posts: 5
Joined: Thu Jan 12, 2006 5:47 am

Saving Australian and other non-US English as RTF

Post by rjking »

We save documents as RTF and want them to follow the Windows Language setting which is English (Australia). This is important as when the RTF document is opened in Word, we want the Australian English spell checker to be used not the English (US) spell checker.

I have coupled TRichViewEdit to ISpell and the LiveSpell checking works correctly - ie it follows my choice of English. I have run the actiontest demo to check if I am doing soemthing wrong but it has the same problem which appears to be that the RTF does not set the deflang, deflangfe and lang tokens: the first two are 0, lang is not set:

The RTF starts {\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl......

I created an RTF document with Word and got deflang1033 and lang3081 in the stylesheet.

So, I added a SaveRTFExtra proc with the code

if Area=rv_rtfs_Doc then
RTFCode := '\deflang3081\deflangfe3081';

This sort of works - Word opens the document and uses the Australian spell checker but if a change is made and the document is saved then when reopened in TRichView it now thinks the document is US English! Also this solution is not good as I don't like there being two deflang's etc in the RTF header.

Does this problem affect other non-US Englishes?

This is a serious problem for us as we have customers in both the US and Australia using the same software. How do we fix this? I have also tried setting Unicode on the textstyle(0) and saving stylesheets - all to no avail. We are using the very latest version of RV.
rjking
Posts: 5
Joined: Thu Jan 12, 2006 5:47 am

Post by rjking »

A bit more info (this has occupied a few hours today!)

Defined {$DEFINE RVLANGUAGEPROPERTY} in rv_defs.inc and rebuilt everything. Set language 3081 on textstyles[0] -- will need to load this somehow from Windows. Now we get the following header

{\rtf1\ansi\ansicpg0\uc1\deff0\deflang3081\deflangfe3081{\fonttbl....

RV and ISpell working correctly. Open saved RTF in Word. Also using Australian English spell checker.

But - make a change in Word and the doc reverts to US English; RTF header changed to :

{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl

So no progress overall, unfortunately. Hoping someone has an answer tomorrow. Thanks in advance.

Richard
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Try to set this value of Language for all text styles
rjking
Posts: 5
Joined: Thu Jan 12, 2006 5:47 am

Post by rjking »

Thanks Sergey. Setting the language ( using GetUserDefaultLangID() ) on all textstyles works well enough for our immediate purposes :) although there is still one glitch.

The document works correctly in RV and when coupled with ISpell the spelling is correct (eg colour is correct for us, color is wrong).

When we save the document as RTF from RV the header is
{\rtf1\ansi\ansicpg0\uc1\deff0\deflang3081\deflangfe3081{\fonttbl....
and there are no \lang3081s anywhere in the RTF.

Word will open this RTF and use the Austrlaian English dictionary (and color will be flagged as wrong). :D

We can then make changes and save the RTF. Now the header is:
{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{...
and there are many \lang3081s (and langnp3081s) as part of the stylesheets in the RTF.

The remaining glitch is that if you open this RTF file (after it has been modified by Word) then RV/ISpell now thinks it is US English and colour etc are marked as wrong.

If you reopen the RTF file in Word (with or without modifying it with RV) Word continues to know that the language is English Australian. This is what we need more than ISpell being correct.

But please add a feature request to have RV properly read and write the sublanguage identifiers in RTF file formats.

Thanks again.
Post Reply