H
haifeng
Unregistered / Unconfirmed
GUEST, unregistred user!
我遇到一个百思不得其解的问题,希望各位高手赐教:
我写的程序是这样的:
WordApp:Variant;
WordApp := CreateOleObject('Word.Basic');
if not VarIsEmpty(WordApp) then
begin
pc :=stralloc(100);
GetWindowsDirectory(pc,StrBufSize(pc));
WordApp.FileOpen(sPath);
FileName :=Strpas(pc)+'/Temp/'+Replaceing(':',DateTimeToStr(Now))+'.rtf';
WordApp.FileSaveAs(Name :=FileName, Format:=6);
WordApp.AppClose;
WordApp:=Unassigned;
RichEdit.Lines.LoadFromFile(FileName);
end
但是用RichEdit打开后成了xml形式了.如下:
<html xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:w="urn:schemas-microsoft-comffice:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="2005-1-4%20150757.files/filelist.xml">
<title>财务管理</title>
<!--[if gte mso 9]><xml>
......
我想用程序实现怎么将Word的Doc文档转换成RTF格式的文件,谁有这方面的经验,请帮忙解决一下.我将非常感激!
我写的程序是这样的:
WordApp:Variant;
WordApp := CreateOleObject('Word.Basic');
if not VarIsEmpty(WordApp) then
begin
pc :=stralloc(100);
GetWindowsDirectory(pc,StrBufSize(pc));
WordApp.FileOpen(sPath);
FileName :=Strpas(pc)+'/Temp/'+Replaceing(':',DateTimeToStr(Now))+'.rtf';
WordApp.FileSaveAs(Name :=FileName, Format:=6);
WordApp.AppClose;
WordApp:=Unassigned;
RichEdit.Lines.LoadFromFile(FileName);
end
但是用RichEdit打开后成了xml形式了.如下:
<html xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:w="urn:schemas-microsoft-comffice:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="2005-1-4%20150757.files/filelist.xml">
<title>财务管理</title>
<!--[if gte mso 9]><xml>
......
我想用程序实现怎么将Word的Doc文档转换成RTF格式的文件,谁有这方面的经验,请帮忙解决一下.我将非常感激!