}
}
}
}
//如果是Excel文件
if (webform.WebOffice.FileType==".xls"){
for (var mSheet=1;mSheet<=webform.WebOffice.ActiveDocument.Application.Sheets.Count;mSheet++){
webform.WebOffice.ActiveDocument.Application.Sheets(mSheet).Select();
for (var mIndex=1;mIndex<=webform.WebOffice.ActiveDocument.ActiveSheet.Shapes.Count;mIndex++){
var mValidString=webform.WebOffice.ActiveDocument.ActiveSheet.Shapes.Item(mIndex).AlternativeText;
if ((mValidString!=null)&&(mValidString.length!=0)){
if ((mValidString.indexOf("DBSTEP_2004")!=-1) && (mValidString.indexOf(webform.WebOffice.RecordID)!=-1)){
SignatureString=SignatureString+"\r\n"+mValidString.substring(12,mValidString.length);
}
}
}
}
}
if (SignatureString){
alert("印章列表如下:"+SignatureString);
}else{
alert("没有找到任何有效印章");
}
}catch(e){}
}
//是否显示工具栏
function WebToolBars(Visible){
try{
webform.WebOffice.ToolBars=Visible;
}catch(e){}
}
//是否显示菜单栏
function WebMenuBar(Visible){
try{
webform.WebOffice.MenuBar=Visible;
}catch(e){}
}
//是否显示某种工具栏
function WebToolsVisible(ToolName,Visible){
try{
webform.WebOffice.ActiveDocument.CommandBars(ToolName).Visible = Visible;
}catch(e){}
}
//是否允许某工具栏上的某工具有效
function WebToolsEnable(ToolName,ToolIndex,Enable){
var i;
try{
for (i=1;i<=webform.WebOffice.ActiveDocument.CommandBars(ToolName).Controls.Count;i++){
if (webform.WebOffice.ActiveDocument.CommandBars(ToolName).Controls(i).id==ToolIndex){
webform.WebOffice.ActiveDocument.CommandBars(ToolName).Controls(i).Enabled = Enable;
break;
}
}
}catch(e){}
}
//设置是否保护
function WebProtect(value){
try{
if (value){
if (webform.WebOffice.FileType==".doc"){
webform.WebOffice.ActiveDocument.Protect(2);
}else if(webform.WebOffice.FileType=='.xls'){
for (var mIndex=1;mIndex<=webform.WebOffice.ActiveDocument.Application.ActiveWorkbook.Sheets.Count;mIndex++){
var mSheet=webform.WebOffice.ActiveDocument.Application.ActiveWorkbook.Sheets(mIndex);
mSheet.Protect("", true, true, true);
}
}
}else{
if (webform.WebOffice.FileType==".doc"){
webform.WebOffice.ActiveDocument.UnProtect();
}else if(webform.WebOffice.FileType=='.xls'){
for (var mIndex=1;mIndex<=webform.WebOffice.ActiveDocument.Application.ActiveWorkbook.Sheets.Count;mIndex++){
var mSheet=webform.WebOffice.ActiveDocument.Application.ActiveWorkbook.Sheets(mIndex);
mSheet.UnProtect("");
}
}
}
}catch(e){}
}
//取得Word内容
function WebGetWordContent(){
try{
alert(webform.WebOffice.ActiveDocument.Content.Text);
}catch(e){}
}
//插入Word内容
function WebSetWordContent(){
var mText=window.prompt("请输入内容:","测试内容");
if (mText==null){
return (false);
}
else
{
&n
bsp; //下面为显示选中的文本
//alert(webform.WebOffice.ActiveDocument.Application.Selection.Range.Text);
//下面为在当前光标出插入文本
webform.WebOffice.ActiveDocument.Application.Selection.Range.InsertAfter (mText+"\n");
来源:upschool.cn
作者:
关键字:翻译
发表日期:2006-7-26
网页显示有限 阅读全文请下载本文完整版WORD文档
上一篇:Asp:base64编码、解码函数 下一篇:突破IIS的客户端连接限制
共13页
9 7 [
1] [
2] [
3] [
4] [
5] [
6] [
7] [
8] [
9] [
10] [
11] [
12] [
13]
8 :>
2009-1-8 20:53:46