zoukankan      html  css  js  c++  java
  • LotusScript & MS WORD

    The below code works very well to export a web view to a .doc file.     When exporting it takes the following format:

    Colum1          column2         colume3
    datadoc1 datadoc1 datadoc1
    datadoc2 datadoc2 datadoc2
    datadoc3 datadoc3 datadoc3

    The export is being formatted as an html table. 

    I've tried this many times, removing the table reference, setting borders to 0, viewing the source and keep encounter problems launching MS WORD and receive an unknown format error (w/word).  Like I said, it works perfectly to export a web view into a table in WORD, just dont want it exported into a table.  Information from this view is being used in a monthly report, which is bulleted and a very large reoirt. 

    Perhaps another set of eyes might be able to see what I am missing.  Any help would be appreciated, I want to revise this code to the following format, removing the table and leaving it as just plain text.

    Format needed:
    datadoc1
    datadoc1
    datadoc1

    datadoc2
    datadoc2
    datadoc2

    datadoc3
    datadoc3
    datadoc3



    The Script:

    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim v As NotesView
    Dim docX As NotesDocument
    Dim col As Integer
    Dim lineitem As String
    Dim View As String
    Dim Query_String As String
    Dim Doc As NotesDocument
    Dim Docs As NotesDocumentCollection
    Dim ViewName As String
    Dim Key As String
    Dim Index1 As Integer
    Dim Index2 As Integer

    Set db = session.CurrentDatabase

    Set Doc = session.DocumentContext
    Query_String = Doc.Query_String(0)

    Index1= Instr(Query_String, "View=")
    If Index1 > 0 Then
    Index1 = Index1 + Len("View=")
    Index2 = Instr(Index1 + 1, Query_String, "&")
    If Index2 > 0 Then
    ViewName = Mid(Query_String, Index1, (Index2 - Index1))
    Else
    ViewName = Mid(Query_String, Index1, Len(Query_String) - Index1 + 1)
    End If
    End If

    Print |Content-Type:application/vnd.ms-word|

    Print |Content-Disposition:Attachment; filename="Report.doc"|

    Set v = db.GetView(ViewName)

    If Key <> "" And Key <> "*" Then
    Set Docs = v.GetAllDocumentsByKey(Key, True)
    End If
    col=1
    Print  |<Table border>|

    lineitem=""
    Forall vColumn In v.Columns              
    If col=1 Then
    lineitem=vColumn.Title
    Else
    lineitem=lineitem+vColumn.Title
    End If
    col=col+1
    End Forall
    lineitem=lineitem

    Print lineitem

    If True Then
    Set docX=v.GetFirstDocument
    lineitem=""
    While Not docX Is Nothing
    col=1
    Forall cValue In docX.ColumnValues
    If col=1 Then
    lineitem=|<tr>|
    End If
    If cValue="" Then  
    lineitem=lineitem+|<td>&nbsp;</td>|
    Else   
    lineitem=lineitem+|<td>|+cValue+|</td>|
    End If
    col=col+1
    End Forall
    Print lineitem+|</tr>|
    Set docX=v.GetNextDocument(docX)
    Wend
    Print |</table>|

    Else
    Set docX=Docs.GetFirstDocument
    lineitem=""
    While Not docX Is Nothing
    col=1
    Forall cValue In docX.ColumnValues
    If col=1 Then
    lineitem=|<tr>|
    End If
    If cValue="" Then   
    lineitem=lineitem+|<td>&nbsp;</td>|
    Else   
    lineitem=lineitem+|<td>|+cValue+|</td>|
    End If
    col=col+1
    End Forall
    Print lineitem+|</tr>|
    Set docX=Docs.GetNextDocument(docX)
    Wend
    Print |</table>|
    End If

    Exit Sub
    End Sub

  • 相关阅读:
    js 实现自增长
    常用的js脚本验证
    Jquery 收集
    Jquery 常用操作搜集
    Jquery 点击绑定行 弹出详细页面
    Jquery 了解
    Html 标尺
    Editor Guidelines
    程序员需要做到
    jS 回车事件
  • 原文地址:https://www.cnblogs.com/hannover/p/2453397.html
Copyright © 2011-2022 走看看