webform.WebOffice.ActiveDocument.Application.Range("D5").Select;
webform.WebOffice.ActiveDocument.Application.ActiveCell.FormulaR1C1 = "40";
//保护工作表
webform.WebOffice.ActiveDocument.Application.Range("B2:D5").Select;
webform.WebOffice.ActiveDocument.Application.Selection.Locked = false;
webform.WebOffice.ActiveDocument.Application.Selection.FormulaHidden = false;
webform.WebOffice.ActiveDocument.Application.ActiveSheet.Protect(true,true,true);
alert("已经保护工作表,只有B2-D5单元格可以修改。");
}
//VBA套红操作
function WebInsertVBA(){
//画线
var object=webform.WebOffice.ActiveDocument;
var myl=object.Shapes.AddLine(100,60,305,60)
myl.Line.ForeColor=255;
myl.Line.Weight=2;
var myl1=object.Shapes.AddLine(326,60,520,60)
myl1.Line.ForeColor=255;
myl1.Line.Weight=2;
//object.Shapes.AddLine(200,200,450,200).Line.ForeColor=6;
var myRange=webform.WebOffice.ActiveDocument.Range(0,0);
myRange.Select();
var mtext="★";
webform.WebOffice.ActiveDocument.Application.Selection.Range.InsertAfter (mtext+"\n");
var myRange=webform.WebOffice.ActiveDocument.Paragraphs(1).Range;
myRange.ParagraphFormat.LineSpacingRule =1.5;
myRange.font.ColorIndex=6;
myRange.ParagraphFormat.Alignment=1;
myRange=webform.WebOffice.ActiveDocument.Range(0,0);
myRange.Select();
mtext="金格发[2003]154号";
webform.WebOffice.ActiveDocument.Application.Selection.Range.InsertAfter (mtext+"\n");
myRange=webform.WebOffice.ActiveDocument.Paragraphs(1).Range;
myRange.ParagraphFormat.LineSpacingRule =1.5;
myRange.ParagraphFormat.Alignment=1;
myRange.font.ColorIndex=1;
mtext="金格电子政务文件";
webform.WebOffice.ActiveDocument.Application.Selection.Range.InsertAfter (mtext+"\n");
myRange=webform.WebOffice.ActiveDocument.Paragraphs(1).Range;
myRange.ParagraphFormat.LineSpacingRule =1.5;
//myRange.Select();
myRange.Font.ColorIndex=6;
myRange.Font.Name="仿宋_GB2312";
myRange.font.Bold=true;
myRange.Font.Size=50;
myRange.ParagraphFormat.Alignment=1;
//myRange=myRange=webform.WebOffice.ActiveDocument.Paragraphs(1).Range;
webform.WebOffice.ActiveDocument.PageSetup.LeftMargin=70;
webform.WebOffice.ActiveDocument.PageSetup.RightMargin=70;
webform.WebOffice.ActiveDocument.PageSetup.TopMargin=70;
webform.WebOffice.ActiveDocument.PageSetup.BottomMargin=70;
}
//保存定稿文件
function WebUpdateFile(){
try{
webform.WebOffice.WebUpdateFile();
if (webform.WebOffice.Error!=""){
alert(webform.WebOffice.Status+webform.WebOffice.Error);
}
}catch(e){}
StatusMsg(webform.WebOffice.Status);
}
//从服务器上导入数据到文档中
function WebInportText(){
var mText;
webform.WebOffice.WebSetMsgByName("COMMAND","INPORTTEXT");
webform.WebOffice.WebSendMessage();
if (webform.WebOffice.Error==""){
mText=webform.WebOffice.WebGetMsgByName("CONTENT");
webform.WebOffice.ActiveDocument.Application.Selection.Range.InsertAfter(mText);
alert("导入文本成功");
}
StatusMsg(webform.WebOffice.Status);
}
//导出所有文档文本给服务器
function WebExportText(){
var mText=webform.WebOffice.ActiveDocument.Content.Text;
webform.WebOffice.WebSetMsgByName("COMMAND","EXPORTTEXT");
webform.WebOffice.WebSetMsgByName("CONTENT",mText);
webform.WebOffice.WebSendMessage();
if (webform.WebOffice.Error==""){
alert("导出文本成功");
}
StatusMsg(webform.WebOffice.Status);
}
//根据标签名称查找标签
function WebFindBookmarks(mPosition)
{
var mBookObject,mBookName,mBookIdx;
if (webform.WebOffice.FileType==".doc"){
for (mBookIdx = 1; mBookI
dx<=webform.WebOffice.ActiveDocument.Bookmarks.Count;mBookIdx++){
mBookName = webform.WebOffice.ActiveDocument.Bookmarks.Item(mBookIdx).Name;
if (mBookName==mPosition) {
mBookObject = webform.WebOffice.ActiveDocument.Bookmarks.Item(mBookIdx).Range;
来源: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 22:10:43