1 转jpg to BMP
function TransJPGToBmp(FileName:PChar):boolean;stdcall;
var
jpg: TJpegImage; //Requires the "jpeg" unit added to "uses" clause.
bmp:TBitmap;
S:String;
begin
jpg := TJpegImage.Create;
bmp:=TBitmap.Create;
try
with jpg do
begin
s:=strpas(FileName);
LoadFromFile(s);
bmp.Assign(jpg);
S:=ChangeFileExt(s,'.bmp');
bmp.SaveToFile(S);
end;
finally
jpg.Free;
bmp.Free;
end;
end;
2 word书签比纯替换好用
try
myWord := CreateOleObject('word.application');
GetActiveOleObject('');
myDoc := myWord.Documents.Open(GetPath+'123.doc');
myDoc.BookMarks.Item('文件编号').Select;
myWord.Selection.Text :='123';
myDoc.BookMarks.Item('内容').Select;
myWord.Selection.Text := '测试文件';
MyWord.Selection.Find.Text := 'word';
MyWord.Selection.Find.Replacement.Text := 'access';
MyWord.Selection.Find.Wrap := 2; //Word2000: wdFindContinue;
MyWord.Selection.Find.Execute(Replace := 2);//Word 2000 : WdReplaceAll
myDoc.SaveAs(GetCurrentDir+'1.doc');
myWord.Visible := True;
except
MessageDlg('对不起,您没有安装Word 软件!', mtInformation,
[mbOk], 0);
abort;
end;
exports
TransJPGToBmp;