客户端文件操作问题 跪求!!!!!!!在线等

unlimitedsaga 2006-08-23 09:15:14
因为权限原因,我需要只打开而不下载,只在客户端显示文件(word,excel,ppt,txt),在网上找了一天都没找到解决的办法,所有的方法都是打开和下载同时存在,有没有什么方法可以只打开文件而不可下载的,只要把文件内容在客户端显示出来就行,最好可提供源代码(C#),请各位大哥帮帮忙了
...全文
177 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
unlimitedsaga 2006-08-23
  • 打赏
  • 举报
回复
为了等到高手,再次自己顶
unlimitedsaga 2006-08-23
  • 打赏
  • 举报
回复
继续自己顶,希望各位高手帮忙解决
unlimitedsaga 2006-08-23
  • 打赏
  • 举报
回复
ASP.NET 未被授权访问所请求的资源。请考虑授予 ASP.NET 请求标识访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 上为网络服务)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。

权限的问题该怎么解决啊
hanguoji84 2006-08-23
  • 打赏
  • 举报
回复
下面的是读WORD的文件内容:
private void Button1_Click(object sender, System.EventArgs e)
{
string strError = "";
Word.Document wDoc=null;
Word.Application wApp=null;
object missing=System.Reflection.Missing.Value;
CreateWordDocument(@"F:\新建文件夹\123.doc",ref wDoc,ref wApp,ref strError);
string str = strError;
TextBox1.Text=wDoc.Content.Text;
}
public static void CreateWordDocument(string FileName, ref Word.Document wDoc,ref Word.Application WApp,ref string strError)
{
if(FileName=="") return;
Word.Document thisDocument=null;

Word.FormFields formFields=null;
Word.ApplicationClass thisApplication=new Word.ApplicationClass();
thisApplication.Visible=true;
thisApplication.Caption="";
thisApplication.Options.CheckSpellingAsYouType=false;
thisApplication.Options.CheckGrammarAsYouType=false;

Object filename=FileName;
Object ConfirmConversions=false;
Object ReadOnly=true;//true;
Object AddToRecentFiles=false;
Object PasswordDocument = System.Type.Missing;
Object PasswordTemplate = System.Type.Missing;
Object Revert = System.Type.Missing;
Object WritePasswordDocument = System.Type.Missing;
Object WritePasswordTemplate = System.Type.Missing;
Object Format = System.Type.Missing;
Object Encoding = System.Type.Missing;
Object Visible = System.Type.Missing;
Object OpenAndRepair = System.Type.Missing;
Object DocumentDirection = System.Type.Missing;
Object NoEncodingDialog = System.Type.Missing;
Object XMLTransform = System.Type.Missing;
object missing=System.Reflection.Missing.Value;
try
{
Word.Document wordDoc =
thisApplication.Documents.Open(ref filename, ref ConfirmConversions,
ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate,
ref Revert,ref WritePasswordDocument, ref WritePasswordTemplate, ref Format,
ref Encoding, ref Visible, ref OpenAndRepair, ref DocumentDirection,
ref NoEncodingDialog );//, ref XMLTransform
thisDocument = wordDoc;
wDoc = wordDoc;
WApp = thisApplication;
formFields = wordDoc.FormFields;
}
catch(Exception ex)
{
strError=ex.Message;
throw new Exception("操作word时出现异常!");
}
unlimitedsaga 2006-08-23
  • 打赏
  • 举报
回复
我试过excel的:
string mystring = "Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = '" + filename + "';Extended Properties=Excel 8.0";
OleDbConnection cnnxls = new OleDbConnection(mystring);
OleDbDataAdapter myDa = new OleDbDataAdapter("select * from [Sheet1$]", cnnxls);
DataSet myDs = new DataSet();
myDa.Fill(myDs);
this.dtgShow.DataSource = myDs.Tables[0];
this.dtgShow.DataBind();
但是报错啊,说sheet1$不存在
hanguoji84 2006-08-23
  • 打赏
  • 举报
回复
txt的读是用:System.IO.StreamReader 具体的参数有解释MSDN也有说明
word的比较复杂等下给你贴上
excel 的网上比较多可以查下
ppt的好像和word的差不多可以寻求下网上的资料
unlimitedsaga 2006-08-23
  • 打赏
  • 举报
回复
谁有例子的源代码
guchang.gu@ecidh.com这是我的邮箱,分不够可以再加
yuchangmao 2006-08-23
  • 打赏
  • 举报
回复
建议采于OLE的方式把文件加进去
unlimitedsaga 2006-08-23
  • 打赏
  • 举报
回复
为了解决问题,自己顶,请各位高手帮忙啊
unlimitedsaga 2006-08-23
  • 打赏
  • 举报
回复
ActiveX控件怎么做啊
fengfangfang 2006-08-23
  • 打赏
  • 举报
回复
或JavaBean
fengfangfang 2006-08-23
  • 打赏
  • 举报
回复
做个ActiveX控件

62,050

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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