MS Word OLE Copy Chinese Text Doesn't Work

I

itibira

Hi,

i have an apparent problem with MS Word OLE which i'm hoping someone
would know the answer to.

i have the following code (using Delphi 7.1 and Word 2000 running in
Windows 2000 Pro):

function ReturnDocParagraphString: widestring;
const
{Constants for enum WdUnits }
wdCharacter = $00000001;
wdParagraph = $00000004;
{Constants for enum WdMovementType}
wdExtend = $00000001;
begin
wrdApp.Selection.EndOf(Unit:=wdParagraph, Extend:=wdExtend);
wrdApp.Selection.Copy;
Result := TntClipboard.AsWideText;
end;

i have a TntMemo that i then copy the result into:

TntMemo1.Lines.Text := ReturnDocParagraphString;

What i see in the TntMemo is question marks always with this bit of
code, except when pasting standard ANSI characters. However if i copy
some Chinese text manually and then use this code to paste it into the
TntMemo:

TntMemo1.Lines.Text := TntClipboard.AsWideText;

then i see the Chinese characters displayed correctly in the TntMemo.

So it appears that the line: wrdApp.Selection.Copy doesn't understand
unicode characters.

Does anyone know how to make this work properly?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top