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

  • 相关阅读:
    容器源码分析之——ArrayList
    JVM详解(四)--运行时数据区:程序计数器(PC 寄存器)
    JVM详解(三)-- 运行时数据区:概述和线程
    JVM详解(二)-- 第2章 类加载器子系统
    vue组件传入样式参数
    vue重定向父路径无法向子路径传递参数
    cpp引用内部的元素指针变化问题
    无法获取vuex中对象的属性
    前端笔记收藏
    vue组件传参
  • 原文地址:https://www.cnblogs.com/hannover/p/2453397.html
Copyright © 2011-2022 走看看