Open(FileName, ReadOnly, Untitled, WithWindow)
Open2007(FileName, ReadOnly, Untitled, WithWindow, OpenAndRepair)
function ConvertPPT2MHT(file)
{
var PPT = new ActiveXObject("PowerPoint.Application");
var Pres = PPT.Presentations.Open(file, false, false, false);
Pres.SaveAs(target_htm_file, 12, false);
Pres.Close();
}
JS实现在线修改服务端office文档
<script language="javascript" type="text/javascript">
function openfile(path)
{
var exName=path.substr(path.lastIndexOf(".")+1).toLowerCase();
var fName=path.substr(path.lastIndexOf("\\")+1).toLowerCase();
if (exName=="doc")
{
var word;
word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Open(path,true,false);
word.Application.Activate();
word.WindowState = 1;
return;
}
if (exName=="xls")
{
var excel;
excel=new ActiveXObject("Excel.Application");
excel.Visible=true;
excel.Workbooks.Open(path,true,false);
excel.WindowState = 1;
return;
}
if (exName=="ppt")
{
var powerpoint;
powerpoint=new ActiveXObject("PowerPoint.Application");
alert(powerpoint);
powerpoint.Visible=true;
powerpoint.Presentations.Open(path,true,false);
return;
}
}
</script>
excel.application的WorkBooks的方法:
[img]http://dl.iteye.com/upload/attachment/241248/dfb9169f-10b1-39f9-bf02-cf8d3ec2b329.jpg[/img]
work.Document方法:
[img]http://dl.iteye.com/upload/attachment/241252/c409548f-9edf-3ba0-ac41-ffde4d7e9743.jpg[/img]
Open(FileName, ReadOnly, Untitled, WithWindow)
Open2007(FileName, ReadOnly, Untitled, WithWindow, OpenAndRepair)
function ConvertPPT2MHT(file)
{
var PPT = new ActiveXObject("PowerPoint.Application");
var Pres = PPT.Presentations.Open(file, false, false, false);
Pres.SaveAs(target_htm_file, 12, false);
Pres.Close();
}
JS实现在线修改服务端office文档
<script language="javascript" type="text/javascript">
function openfile(path)
{
var exName=path.substr(path.lastIndexOf(".")+1).toLowerCase();
var fName=path.substr(path.lastIndexOf("\\")+1).toLowerCase();
if (exName=="doc")
{
var word;
word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Open(path,true,false);
word.Application.Activate();
word.WindowState = 1;
return;
}
if (exName=="xls")
{
var excel;
excel=new ActiveXObject("Excel.Application");
excel.Visible=true;
excel.Workbooks.Open(path,true,false);
excel.WindowState = 1;
return;
}
if (exName=="ppt")
{
var powerpoint;
powerpoint=new ActiveXObject("PowerPoint.Application");
alert(powerpoint);
powerpoint.Visible=true;
powerpoint.Presentations.Open(path,true,false);
return;
}
}
</script>
excel.application的WorkBooks的方法:
[img]http://dl.iteye.com/upload/attachment/241248/dfb9169f-10b1-39f9-bf02-cf8d3ec2b329.jpg[/img]
work.Document方法:
[img]http://dl.iteye.com/upload/attachment/241252/c409548f-9edf-3ba0-ac41-ffde4d7e9743.jpg[/img]
ppt.presentations方法
Presentations.Open 方法
Function Open(FileName As String, [Password As VARIANT], [ReadOnly As KsoTriState = 0], [Untitled As KsoTriState = 0], [WithWindow As KsoTriState = -1]) As Presentation参数说明
FileName
String 类型,必需。表示要打开的演示文稿的名称。
Password
String 类型,可选。表示打开指定的演示文稿需要指定的密码。
ReadOnly
KsoTriState 类型,可选。表示是否以只读方式打开指定的演示文稿。
Untitled
KsoTriState 类型,可选。表示打开的演示文稿是否为无标题。
WithWindow
KsoTriState 类型,可选。表示打开的演示文稿是否可见。
返回值
Presentation 对象
[img]http://dl.iteye.com/upload/attachment/241260/46c4b546-e664-37c2-8e5f-2e45775c9e94.jpg[/img]
Open2007(FileName, ReadOnly, Untitled, WithWindow, OpenAndRepair)
function ConvertPPT2MHT(file)
{
var PPT = new ActiveXObject("PowerPoint.Application");
var Pres = PPT.Presentations.Open(file, false, false, false);
Pres.SaveAs(target_htm_file, 12, false);
Pres.Close();
}
JS实现在线修改服务端office文档
<script language="javascript" type="text/javascript">
function openfile(path)
{
var exName=path.substr(path.lastIndexOf(".")+1).toLowerCase();
var fName=path.substr(path.lastIndexOf("\\")+1).toLowerCase();
if (exName=="doc")
{
var word;
word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Open(path,true,false);
word.Application.Activate();
word.WindowState = 1;
return;
}
if (exName=="xls")
{
var excel;
excel=new ActiveXObject("Excel.Application");
excel.Visible=true;
excel.Workbooks.Open(path,true,false);
excel.WindowState = 1;
return;
}
if (exName=="ppt")
{
var powerpoint;
powerpoint=new ActiveXObject("PowerPoint.Application");
alert(powerpoint);
powerpoint.Visible=true;
powerpoint.Presentations.Open(path,true,false);
return;
}
}
</script>
excel.application的WorkBooks的方法:
[img]http://dl.iteye.com/upload/attachment/241248/dfb9169f-10b1-39f9-bf02-cf8d3ec2b329.jpg[/img]
work.Document方法:
[img]http://dl.iteye.com/upload/attachment/241252/c409548f-9edf-3ba0-ac41-ffde4d7e9743.jpg[/img]
Open(FileName, ReadOnly, Untitled, WithWindow)
Open2007(FileName, ReadOnly, Untitled, WithWindow, OpenAndRepair)
function ConvertPPT2MHT(file)
{
var PPT = new ActiveXObject("PowerPoint.Application");
var Pres = PPT.Presentations.Open(file, false, false, false);
Pres.SaveAs(target_htm_file, 12, false);
Pres.Close();
}
JS实现在线修改服务端office文档
<script language="javascript" type="text/javascript">
function openfile(path)
{
var exName=path.substr(path.lastIndexOf(".")+1).toLowerCase();
var fName=path.substr(path.lastIndexOf("\\")+1).toLowerCase();
if (exName=="doc")
{
var word;
word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Open(path,true,false);
word.Application.Activate();
word.WindowState = 1;
return;
}
if (exName=="xls")
{
var excel;
excel=new ActiveXObject("Excel.Application");
excel.Visible=true;
excel.Workbooks.Open(path,true,false);
excel.WindowState = 1;
return;
}
if (exName=="ppt")
{
var powerpoint;
powerpoint=new ActiveXObject("PowerPoint.Application");
alert(powerpoint);
powerpoint.Visible=true;
powerpoint.Presentations.Open(path,true,false);
return;
}
}
</script>
excel.application的WorkBooks的方法:
[img]http://dl.iteye.com/upload/attachment/241248/dfb9169f-10b1-39f9-bf02-cf8d3ec2b329.jpg[/img]
work.Document方法:
[img]http://dl.iteye.com/upload/attachment/241252/c409548f-9edf-3ba0-ac41-ffde4d7e9743.jpg[/img]
ppt.presentations方法
Presentations.Open 方法
Function Open(FileName As String, [Password As VARIANT], [ReadOnly As KsoTriState = 0], [Untitled As KsoTriState = 0], [WithWindow As KsoTriState = -1]) As Presentation参数说明
FileName
String 类型,必需。表示要打开的演示文稿的名称。
Password
String 类型,可选。表示打开指定的演示文稿需要指定的密码。
ReadOnly
KsoTriState 类型,可选。表示是否以只读方式打开指定的演示文稿。
Untitled
KsoTriState 类型,可选。表示打开的演示文稿是否为无标题。
WithWindow
KsoTriState 类型,可选。表示打开的演示文稿是否可见。
返回值
Presentation 对象
[img]http://dl.iteye.com/upload/attachment/241260/46c4b546-e664-37c2-8e5f-2e45775c9e94.jpg[/img]
本文介绍了使用JavaScript在服务端修改Word、Excel和PPT文件的方法,包括打开文档、保存和关闭操作。

1248

被折叠的 条评论
为什么被折叠?



