一个很久没有人答的问题。关于用delphi编写一个给ASP.net调用的dll。我急,急,急!!!

guizhaoshou 2006-12-27 05:07:09
如何用delphi编写一个给ASP.net调用的dll,dll里要实现能提取word文档信息。
我用Active server Object来做过
下面是代码:

unit helloASP;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
ComObj, ActiveX, AspTlb, server_TLB, StdVcl,
Variants, Wordxp, Windows, Messages, SysUtils,
Classes, Graphics, Controls;

type
Thello = class(TASPObject, Ihello)
protected
procedure OnEndPage; safecall;
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
procedure test; safecall;
end;

implementation

uses ComServ;

procedure Thello.OnEndPage;
begin
inherited OnEndPage;
end;

procedure Thello.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;

procedure Thello.test;
var
VarWord:Variant;
begin
VarWord:=CreateOleObject('Word.Application'); //创建word类对象
VarWord.Documents.Open(FileName:=server.MapPath('Sample.doc'), ReadOnly:=True);
VarWord.Visible := false; //是否显示文件编辑
VarWord.ActiveDocument.SaveAs(server.MapPath('Sample.rtf'),wdFormatRTF);
VarWord.Quit(false);
response.Write('Hello World!');
end;

initialization
TAutoObjectFactory.Create(ComServer, Thello, Class_hello,
ciMultiInstance, tmApartment);
end.
提示:拒绝访问Thello.test方法。
但是把有关word对象的代码注释调,就能正常了。这是什么问题?
请大家来帮忙看看。
...全文
125 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
guizhaoshou 2006-12-29
  • 打赏
  • 举报
回复
to : cangwu_lee(橙子)
"ASP.net 权限不足。"是什么意思,能说的详细点吗?谢谢!
cangwu_lee 2006-12-27
  • 打赏
  • 举报
回复
ASP.net 权限不足。

--------------------------------------------------------------
程序,犹如人生。
yi10000 2006-12-27
  • 打赏
  • 举报
回复
楼主,我回答,可惜不能给你解决问题,嘻嘻..

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧