<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    guanxf

    我的博客:http://blog.sina.com.cn/17learning

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      71 隨筆 :: 1 文章 :: 41 評論 :: 0 Trackbacks

    1、簡單方法:
    問題automation服務(wù)器不能創(chuàng)建對象
    解決辦法:如果javascript腳本中報(bào)這個(gè)錯(cuò)誤是因?yàn)?span style="color: red">IE的安全設(shè)置不允許運(yùn)行未標(biāo)記為安全的activeX控件 更改IE的安全設(shè)置,把相應(yīng)的選項(xiàng)打開即可。

    Sub Initialize
    Dim s As New NotesSession
    Dim curdoc As NotesDocument
    Dim curdb As NotesDatabase
    Dim vw As NotesView
    Dim doc As NotesDocument
    Dim et As NotesViewEntry
    Dim i
    i=3
    Set curdb=s.CurrentDatabase
    Set vw=curdb.GetView("UmSafetyInfo")
    Set doc=vw.GetFirstDocument
    'Dim x As Variant
    'tempstr=|@name([OU2];'|+curdoc.remote_user(0)+|')|
    'x=Evaluate(tempstr)
    'Msgbox x(0)
    Print |
    <script language=javascript>
    var xls = new ActiveXObject ( "Excel.Application" );
    //xls.visible = "false";
    var xlBook = xls.Workbooks.Add;
    var xlsheet = xlBook.Worksheets(1);
    xls.Cells.Select;
    xlsheet.Cells(2,1).Value="部門";
    xlsheet.Cells(2,2).Value="姓名";
    xlsheet.Cells(2,3).Value="分機(jī)";
    xlsheet.Cells(2,4).Value="移動(dòng)電話";
    xlsheet.Cells(2,5).Value="手機(jī)小號";
    xlsheet.Cells(2,6).Value="電子郵件";
    xlsheet.Cells(2,7).Value="直撥電話";
    xlsheet.Rows(2).Font.Bold=1;
    xlsheet.Rows(2).Font.Name="宋體";
    xlsheet.Range("A1","G1").MergeCells = 1;
    xlsheet.Cells(1,1).Value="某某公司";
    xlsheet.Range("A1","A1").HorizontalAlignment = 3
    //xlsheet.Range("A2","G2").ColorIndex = 48
    xlsheet.Rows(1).Font.Bold=1;
    xlsheet.Rows(1).Font.Name="黑體";
    xlsheet.Rows(1).Font.Size=16;
    xlsheet.Rows(2).Font.Size=9;
    xlsheet.Columns(1).ColumnWidth = 25
    xlsheet.Columns(2).HorizontalAlignment=3
    xlsheet.Columns(3).HorizontalAlignment=3
    xlsheet.Columns(4).HorizontalAlignment=3
    xlsheet.Columns(4).ColumnWidth = 13.63
    xlsheet.Columns(5).HorizontalAlignment=3
    xlsheet.Columns(6).HorizontalAlignment=3
    xlsheet.Columns(6).ColumnWidth = 25
    xlsheet.Columns(7).HorizontalAlignment=3
    xlsheet.Columns(7).ColumnWidth = 13.63
    |

    Do While Not (doc Is Nothing)
    Print |xlsheet.Rows(|+i|).Font.Size=9;|
    Print |xlsheet.Cells(| +i+|,1).Value='|+"Mid(doc.department(0),1)"+|';|
    Print |xlsheet.Cells(| +i+|,2).Value='|+"doc.name(0)"+|';|
    Print |xlsheet.Cells(| +i+|,3).Value='|+"Cstr(doc.OfficeTelExt(0))"+|';|
    Print |xlsheet.Cells(| +i+|,4).Value='|+"Cstr(doc.Cellphone(0))"+|';|
    Print |xlsheet.Cells(| +i+|,5).Value='|+"Cstr(doc.CellphoneLittle(0))"+|';|
    Print |xlsheet.Cells(| +i+|,6).Value='|+"doc.Email(0)"+|';|
    Print |xlsheet.Cells(| +i+|,7).Value='|+"Cstr(doc.OfficeTel(0))"+|';|
    i=i+1
    Set doc=vw.GetNextDocument(doc)
    Loop
    Print |
    xlBook.SaveAs("c:\\通訊錄.xls");
    xlBook.Close ();

    xls.Quit();
    xls=null;
    alert("已經(jīng)保存在C盤 通訊錄.xls文件中");
    Temp=window.location.href.toLowerCase();

    Temp=Temp.substring(0,Temp.lastIndexOf(".nsf")+5)+"UmSafetyInfo?openview";
    window.location=Temp;

    </script>
    |
    End Sub

     

     2、常用方法:

     Sub Initialize
     On Error GoTo errormsg  
     Dim session As New NotesSession
     Dim cdoc As NotesDocument
     Dim doc As NotesDocument
     Dim view As NotesView
     Dim db As NotesDatabase
     Dim dc As NotesDocumentCollection
     Set db=session.currentdatabase
     Set cdoc=session.documentcontext
     Set view=db.GetView("UmSafetyInfo") 
     
     tempDir=session.GetEnvironmentString("Directory", True)  '獲取環(huán)境變量,將代理權(quán)限設(shè)低
     If InStr(tempDir, "/") <> 0 And Right(tempDir, 1) <> "/" Then
       tempDir = tempDir & "/domino/html/"
     End If 
     If InStr(tempDir, "\") <> 0 And Right(tempDir, 1) <> "\" Then
       tempDir = tempDir & "\domino\html\"
     End If
        filename="中國電信四川公司安全管理人員數(shù)據(jù)庫.xls" 
     filepath=tempDir & filename
     
     Print |<script language="javascript">alert(|+filepath+|)</script>|
     If Dir(filePath)<>"" Then Kill filePath
     Dim excelapplication As Variant
     Dim excelworkbook As Variant
     Dim excelsheet As Variant
     Dim i As Integer
     Dim uvcols As Integer
     Dim selection As Variant
     Set excelapplication=CreateObject("Excel.Application")
     excelapplication.statusbar="正在創(chuàng)建工作表,請稍等.."
     excelapplication.Visible=False
     Set excelWorkbook = excelApplication.Workbooks.Add
     Set excelSheet = excelWorkbook.Worksheets("sheet1")
     excelsheet.name="中國電信四川公司安全管理人員數(shù)據(jù)庫" '工作表的名字
     
     Dim rows As Integer
     Dim cols As Integer
     Dim maxcols As Integer
     Dim fieldname As String
     Dim fitem As NotesItem
     rows=1 
     excelapplication.statusbar="正在創(chuàng)建單元格,請稍等.."  
     excelapplication.Range(excelsheet.Cells(rows, 1), excelsheet.Cells

    (rows, 12)).Merge   '設(shè)置title跨幾行顯示
      
      rows=2
     excelsheet.Rows(2).Font.Bold=1
     excelsheet.Rows(2).Font.Name="宋體"
     excelsheet.Range("A1","L1").MergeCells = 1
     excelsheet.Cells(1,1).Value="中國電信四川公司安全管理人員數(shù)據(jù)庫"
     excelsheet.Range("A1","A1").HorizontalAlignment = 3
     REM  設(shè)置風(fēng)格
     excelsheet.Rows(1).Font.Bold=1
     excelsheet.Rows(1).Font.Name="黑體"
     excelsheet.Rows(1).Font.Size=16
     excelsheet.Rows(2).Font.Size=9
     excelsheet.Columns(1).ColumnWidth = 25
     excelsheet.Columns(2).HorizontalAlignment=3
     excelsheet.Columns(3).HorizontalAlignment=3
     excelsheet.Columns(4).HorizontalAlignment=3
     excelsheet.Columns(4).ColumnWidth = 13.63
     excelsheet.Columns(5).HorizontalAlignment=3
     excelsheet.Columns(6).HorizontalAlignment=3
     excelsheet.Columns(6).ColumnWidth = 25
     excelsheet.Columns(7).HorizontalAlignment=3
     excelsheet.Columns(7).ColumnWidth = 13.63
     
     excelsheet.Cells(rows,1).value="單位名稱"
     excelsheet.Cells(rows,2).value="分管領(lǐng)導(dǎo)"
     excelsheet.Cells(rows,3).value="姓名"
     excelsheet.Cells(rows,4).value="安辦職務(wù)"
     excelsheet.Cells(rows,5).value="性別"
     excelsheet.Cells(rows,6).value="出生年月"
     excelsheet.Cells(rows,7).value="學(xué)歷"
     excelsheet.Cells(rows,8).value="崗位名稱"
     excelsheet.Cells(rows,9).value="是否兼職"
     excelsheet.Cells(rows,10).value="兼職名稱"
     excelsheet.Cells(rows,11).value="聯(lián)系電話"
     excelsheet.Cells(rows,12).value="手機(jī)"
     
     cols=12
     maxcols=cols-1 
     excelapplication.statusbar="正在導(dǎo)出數(shù)據(jù),請稍等.."
     Set doc=view.Getfirstdocument()
     While Not doc Is Nothing
      rows=rows+1  
      excelsheet.Cells(rows,1).value=doc.UmDeptName(0)
      excelsheet.Cells(rows,2).value=doc.UmManageLeader(0)
      excelsheet.Cells(rows,3).value=doc.UmUserName(0)
      excelsheet.Cells(rows,4).value=doc.UmWorking(0)
      excelsheet.Cells(rows,5).value=doc.UmSex(0)
      excelsheet.Cells(rows,6).value=doc.UmBirtyday(0)
      excelsheet.Cells(rows,7).value=doc.UmEducation(0)
      excelsheet.Cells(rows,8).value=doc.UmWorkName(0)
      excelsheet.Cells(rows,9).value=doc.UmIsFullTime(0)
      excelsheet.Cells(rows,10).value=doc.UmPartTimeWork(0)
      excelsheet.Cells(rows,11).value=doc.UmTel(0)
      excelsheet.Cells(rows,12).value=doc.UmMoblie(0)
      Set doc = view.GetNextDocument(doc)
     Wend
     excelapplication.statusbar="數(shù)據(jù)導(dǎo)入完成。" 
     excelWorkbook.SaveAs(filePath)
     excelApplication.Quit  
     Set excelapplication=Nothing
      Print "<script>location.href='/"+ filename  +"'</script>" 
     Exit Sub
     
    errormsg:
     MsgBox "OutExcel Error:" & Str(Erl) & "  " & Error 
    End Sub

     

    posted on 2012-01-05 17:15 管先飛 閱讀(2789) 評論(0)  編輯  收藏 所屬分類: Lotus Notes
    主站蜘蛛池模板: 久久久久国色AV免费看图片| 182tv免费视视频线路一二三| 国产免费久久精品久久久| 在线aⅴ亚洲中文字幕| 亚洲一区二区免费视频| 亚洲的天堂av无码| 亚洲免费在线观看视频| 亚洲一级高清在线中文字幕| 无码人妻精品中文字幕免费东京热| 亚洲欧洲精品国产区| 18勿入网站免费永久| 亚洲精品色播一区二区| 国产成人青青热久免费精品| 美女视频黄频a免费观看| 免费人成网站在线播放| 国产免费A∨在线播放| 亚洲AV无码AV男人的天堂| 最近2019免费中文字幕视频三| 亚洲国产成人久久精品app| 免费观看毛片视频| 瑟瑟网站免费网站入口| 亚洲精品无码久久一线| 91香蕉国产线观看免费全集| 亚洲综合一区无码精品| 亚洲乱码中文字幕综合234| 黄页免费在线观看| 亚洲Av无码一区二区二三区| 国产成人免费高清在线观看 | 国产亚洲精品影视在线产品| 中文字幕免费视频精品一| 亚洲自偷自拍另类图片二区| 国产免费小视频在线观看| 国产一级在线免费观看| 亚洲精品午夜久久久伊人| 美女被免费视频网站a国产 | 国产成人精品亚洲2020| 久久亚洲AV永久无码精品| 免费观看美女用震蛋喷水的视频| 老子影院午夜伦不卡亚洲| 亚洲精品线在线观看| 免费永久国产在线视频|