Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word OLE Copy Chinese Text Doesn't work

Status
Not open for further replies.

itibira

Programmer
Dec 11, 2005
3
CA
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:

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 declaration:
wrdApp.Selection.Copy

doesn't understand unicode characters? Or what could it be?

Does anyone know how to make this work properly?

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top