Bonjour,
Mon nouveau problème est le suivant:
Mon entreprise reçoit souvant des lettre provenant de pologne, écrit dans un fichier . doc, et à la police Times New Roman.
Lorsque l'on fait un copier/coller dans un fichier .txt Les caractères spéciaux ne sont pas visibles.
Le but de l'application serait de pouvoir ouvrir le fichier .doc et de le convertir en fichier .txt tout en conservant les caractère d'origine.
Pour le moment, j'essaye de tester (en grand debutant que je suis...) de diverse manière en utilisant les canvas mais cela affiche des caractère bizard comme: []&.
Voici le source dans le lequel on essaye avec les caractère chinois( a savoir que mon tuteur est aussi perdu que moi sur le sujet):
procedure XieHanZi(Canvas:TCanvas; x,y:integer; GB:string);
var
W:PWideChar;
GBlength, UNILength, WSize:integer;
begin
GBLength:=Length(GB);
WSize:=GBLength*2 + 2;
GetMem(W, WSize);
ZeroMemory(W,WSize);
MultiByteToWideChar(CP_UTF8,0,PChar(GB),GBLength,W,WSize);
// Get length of UNICODE string
UNILength:=LStrLenW(W);
// Write the text
TextOutW(Canvas.Handle, x,y,W,UNILength);
// Clean up
FreeMem(W, GBLength*2+2);
end;
procedure TFrameForm.FormPaint(Sender: TObject);
var
x : integer;
y : integer;
row,col:integer;
const
hh = 10;
begin
Canvas.Font.Name :='Times New Roman';
Canvas.Font.Style :=[];
y:=0;
Canvas.Font.CharSet:= ANSI_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= DEFAULT_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= SYMBOL_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= SHIFTJIS_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= HANGEUL_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= GB2312_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= CHINESEBIG5_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= OEM_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= JOHAB_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= HEBREW_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= ARABIC_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= GREEK_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= TURKISH_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= VIETNAMESE_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= THAI_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= EASTEUROPE_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= RUSSIAN_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= MAC_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
Canvas.Font.CharSet:= BALTIC_CHARSET ; XieHanZi (Canvas,50, y, #$01+#$26 ); y:=y+20;
end;
end.
-----------------------------------------------
Merci d'avance pour ta réponse!