Разное
Последние книги
Самое популярное
Все бесплатно
Все ссылки на файлы, расположенные на страницах сайта, добавлены пользователями и доступны для бесплатного скачивания. За содержание этих файлов администрация сайта ответственности не несет.
Навигация
Вопросы
Delphi - База Знаний: Сохранить документ Word как RTF на DELPHI
uses
comobj;
function convertdoc2rtf(var filename: string) : boolean;
var
oword: olevariant;
odoc: olevariant;
begin
result := false;
try
oword := getactiveoleobject('word.application');
except
oword := createoleobject('word.application');
end;
oword.documents.open(filename);
odoc := oword.activedocument;
filename := changefileext(filename, '.rtf');
odoc.saveas(filename);
oword.activedocument.close(wddonotsavecВhanges, emptyparam, emptyparam);
oword.quit(emptyparam, emptyparam, emptyparam);
odoc := varnull;
oword := varnull;
result := true;
end;
procedure tform1.button1click(sender: tobject);
const
filename = 'c:\document.doc';
begin
if convertdoc2rtf(filename) then
begin
showmessage('word document has been converted to .rtf');
richedit1.lines.loadfromfile(filename);
end;
end;