问一个与DSOframer有关的问题

ilmic 2011-04-16 09:13:07
document.all.FramerControl1.Open("C:\\Plain.txt",false, "Word.Document");

使用这个方法会出现这样的错误提示:

没有可访问的“Open”接受此数目的参数,因此重载决策失败。


使用的控件版本是2.3.0.1



...全文
444 17 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwhh520 2011-05-27
  • 打赏
  • 举报
回复
可以发一发给我吗?邮箱:shuhua55@yeah.net
谢谢
ilmic 2011-05-07
  • 打赏
  • 举报
回复
非常感谢楼上的朋友!
独立级IT民工 2011-04-28
  • 打赏
  • 举报
回复
楼主,已经发了,请注意接收。希望能对你有帮助。运行程序的时候,请先运行Debug下的officeEmbed.ocx.
即在开始运行中输入regsvr32 此ocx控件的实际路径。
ilmic 2011-04-27
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 dxd0128 的回复:]

楼主,把邮箱告诉我,晚上发给你啊。
[/Quote]
ilmic@sina.com.cn

非常感谢啊。。!
独立级IT民工 2011-04-27
  • 打赏
  • 举报
回复
楼主,把邮箱告诉我,晚上发给你啊。
ilmic 2011-04-26
  • 打赏
  • 举报
回复
document.all是IE 4.0及以上版本的专有属性,是一个表示当前文档的所有对象的娄组,不仅包括页面上可见的实体对象,还包括一些不可见的对象,比如html注释等等。在document.all数组里面,元素不分层次,是按照其在文档中出现的先后顺序,平行地罗列的。所以可以用数字索引来引用到任何一个元素。但比较常用的是用对象id来引用一个特定的对象,比如document.all["element"]这样。

document.layers是Netscape 4.x专有的属性,是一个代表所有由储如<div><layer>等定位了的元素的数组。通常也是用<div>或<layer>对象的id属性来引用的,但是这里面不包含除此以外的其它元素。

其实这两个属性没什么可比性,大概你经常看到他们同时出时,这有一个历史原因。在第四代浏览器出现的时候,标准相当混乱,Netscape和微软分别推出了它们的Navigator 4.x和IE 4.0,这两个浏览器的巨大差异,也使开发者面临了一个使网页跨浏览器兼容的噩梦。而document.layer和document.all分别是两者一个最显著的标志,为了确定浏览者使用的什么浏览器,通常用是否存在document.layers和document.all来判断。
ilmic 2011-04-26
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 dxd0128 的回复:]
VB.NET code

document.all.FramerControl1.Open("C:\\Plain.txt",false, "Word.Document");


dsoframer控件只能用这种方式来打开文本文档,我上面给你写的那个例子你放到程序里试一下走一下流程就明白了。
[/Quote]

大虾可不可以发一份VB.net的源码呢...或者已经写好的程序压缩包,折腾半天VS一直报错,呵呵..
独立级IT民工 2011-04-25
  • 打赏
  • 举报
回复

document.all.FramerControl1.Open("C:\\Plain.txt",false, "Word.Document");

dsoframer控件只能用这种方式来打开文本文档,我上面给你写的那个例子你放到程序里试一下走一下流程就明白了。
ilmic 2011-04-23
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 dxd0128 的回复:]

C# code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using……
[/Quote]

大虾你好,这个代码有点没看明白。
你这里应该是用dsoframer创建了一个新的word文档,但是打开好像是用的vba的方式...
我这里遇到个问题就是用dsoframer这个控件来打开txt文档,程序一直提示我的格式不被open方法支持,但是这个格式是从使用手册上copy来的,不明白是哪里出了问题...
包括我修改了MS的DEMO也有同样的提示,有可能是需要完整的命名空间,我这个已经是完整的啊...
独立级IT民工 2011-04-21
  • 打赏
  • 举报
回复

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Word = Microsoft.Office.Interop.Word;


private Word.Document bidDocument;
private Word.Application bidApplication;
private object missing = Type.Missing;

private void button1_Click(object sender, EventArgs e)
{
axframercontrol.CreateNew("Word.Document.8");
axframercontrol.Caption = "金康玉妍技术宝典修改版";

bidDocument = (Word.Document)axframercontrol.ActiveDocument;
//bidDocument.ActiveWindow.View.Type = Word.WdViewType.wdOutlineView;
//bidDocument.ActiveWindow.DisplayRulers = false;
//bidDocument.ActiveWindow.DisplayScreenTips = false;
//bidDocument.ActiveWindow.DisplayHorizontalScrollBar = false;
//bidDocument.ActiveWindow.DisplayVerticalRuler = false;
//bidDocument.ActiveWindow.DisplayVerticalScrollBar = true;

bidApplication = bidDocument.Application;
if (double.Parse(bidApplication.Version) > 11)
axframercontrol.Menubar = false;
else
{
//禁用新建、打开、关闭菜单按钮
axframercontrol.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileNew, false);
axframercontrol.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileOpen, false);
axframercontrol.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileClose, false);
}

OpenWord(@"D:\代码.txt");
}

private void OpenWord(string fileName)
{//
object tempFile = fileName;
object tempPwd = "123456";
object none = "";
object format = Word.WdOpenFormat.wdOpenFormatAuto;

Word.ApplicationClass app = null;
try
{
app = new Microsoft.Office.Interop.Word.ApplicationClass();
Word.Document tempDoc = app.Documents.Open(ref tempFile, ref yes, ref no, ref no, ref tempPwd,
ref none, ref no, ref none, ref none, ref format, ref missing,
ref no, ref no, ref missing, ref missing, ref missing);
tempDoc.Password = "";
tempDoc.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection, ref missing, ref tempPwd, ref missing, ref missing);
tempDoc.Save();
}
catch { }
finally
{
if (app != null)
app.Quit(ref yes, ref missing, ref missing);
}

bidDocument.Activate();
bidApplication.Selection.InsertFile(fileName, ref missing, ref missing, ref missing,
ref missing);
}


用C# 写了一个没整理,你看一下吧
ilmic 2011-04-19
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 whycom 的回复:]
document.all.FramerControl1.Open("files://C:\\Plain.txt",false, "Word.Document");
试试
[/Quote]

不知道她这个Document的命名空间是哪儿来的...
只用open的第一个参数就可以,
我看了dsoframercontrol的源码,参数的描述也是这样的。
修改了MS提供的DEMO,也不支持readonly这个参数。
ilmic 2011-04-19
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 whycom 的回复:]
document.all.FramerControl1.Open("files://C:\\Plain.txt",false, "Word.Document");
[/Quote]

document.all.FramerControl1.Open("C:\\Plain.txt",false, "Word.Document")

document.all
这个似乎是JAVA代码。。。
whycom 2011-04-18
  • 打赏
  • 举报
回复
document.all.FramerControl1.Open("files://C:\\Plain.txt",false, "Word.Document");
whycom 2011-04-18
  • 打赏
  • 举报
回复
document.all.FramerControl1.Open("files://C:\\Plain.txt",false, "Word.Document");
试试
ilmic 2011-04-18
  • 打赏
  • 举报
回复
将语句改为 open (filestr,cobj(false),"word.document") 这种样子也不行。
ilmic 2011-04-18
  • 打赏
  • 举报
回复
没人了吗?

16,721

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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