只是从网上拷贝下来,没有测试。

得到上传文件的路径
http://searchdomino.techtarget.com/tip/Trap-an-attachment-path-via-the-Domino-file-upload-control-field

Move Web Attachment To Rich Text Field
http://spacemover.wordpress.com/2008/09/17/domino-development-move-web-attachment-to-rich-text-field/
http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256BC80071114F

The file upload control feature provided in Notes is used to attach files to a document from the web. But it ends up placing the attachment at the bottom of your document instead of in a rich text field. (Those of us who have been using Notes for a long time know this as a "V2 Attachment"). Here is some script that will take the attachment and place it into a rich text field. Place this code into your web query save agent for the form being created.

Sub Initialize
Dim s As New notesSession
Dim doc As notesDocument
Set doc = s.documentContext
Call WebMoveAttachment(Doc, "<Your Rich Text Field Name>")
End Sub

The subroutine "WebMoveAttachment" does the work of moving the attachment to the rich text field.

Function WebMoveAttachment(doc As notesDocument, Byval moveToFieldName As String)
' This function moves a file attached via the Web with the File Upload Control to a rich text field.
Dim s As New notesSession
Dim tempDir As String
Dim v2FileNames As Variant
Dim i As Integer
Dim attachedFile As notesEmbeddedObject
Dim filePath As String
Dim rtItem As notesRichTextItem

tempDir = s.getEnvironmentString("Directory", True)
' Put a trailing slash at the end of the directory if it is needed
If Instr(tempDir, "/") <> 0 And Right(tempDir, 1) <> "/" Then tempDir = tempDir & "/"
If Instr(tempDir, "\") <> 0 And Right(tempDir, 1) <> "\" Then tempDir = tempDir & "\"
' Get the names of all the attachments (1 or more)
v2FileNames = Evaluate("@AttachmentNames", doc)
For i = Lbound(v2FileNames) To Ubound(v2FileNames)
If v2FileNames(i) <> "" Then ' Make sure it's a valid file name
Set attachedFile = doc.getAttachment(v2FileNames(i))
filePath = tempDir & v2FileNames(i)
' Save the file on the server
Call attachedFile.extractFile(filePath)
' Create the rich text item and re-attach the file
If doc.hasItem(moveToFieldName) Then
Set rtItem = doc.getFirstItem(moveToFieldName)
' Add a couple of lines to the rich text field before re-attaching the file
Call rtItem.addNewLine(2)
Else
Set rtItem = New notesRichTextItem(doc, moveToFieldName)
End If
Call rtItem.embedObject(1454, "", filePath)
' Delete the file(s) from the server file system
Kill filePath
End If
Next ' Move on to the next file name
End Function

Domino移动Web上传的附件到RichText域的更多相关文章

  1. 文件批量上传-统一附件管理器-在线预览文件(有互联网和没有两种)--SNF快速开发平台3.0

    实际上在SNF里使用附件管理是非常简单的事情,一句代码就可以搞定.但我也要在这里记录一下统一附件管理器能满足的需求. 通用的附件管理,不要重复开发,调用尽量简洁. 批量文件上传,并对每个文件大小限制, ...

  2. 前端之web上传文件的方式

    前端之web上传文件的方式 本节内容 web上传文件方式介绍 form上传文件 原生js实现ajax上传文件 jquery实现ajax上传文件 form+iframe构造请求上传文件 1. web上传 ...

  3. 第九篇:web之前端之web上传文件的方式

    前端之web上传文件的方式   前端之web上传文件的方式 本节内容 web上传文件方式介绍 form上传文件 原生js实现ajax上传文件 jquery实现ajax上传文件 form+iframe构 ...

  4. 关于confluence上传文件附件预览查看时出现乱码的问题解决办法

    在confluence上传excel文件,预览时发现乱码问题主要是因为再上传文件的时候一般是Windows下的文件上传,而预览的时候,是linux下的环境,由于linux下没有微软字体,所以预览的时候 ...

  5. confluence上传文件附件预览乱码问题(linux服务器安装字体操作)

    在confluence上传excel文件,预览时发现乱码问题主要是因为再上传文件的时候一般是Windows下的文件上传,而预览的时候,是linux下的环境,由于linux下没有微软字体,所以预览的时候 ...

  6. Web上传文件的原理及实现

    现在有很多Web程序都有上传功能,实现上传功能的组件或框架也很多,如基于java的Commons FileUpload.还有Struts1.x和Struts2中带的上传文件功能(实际上,Struts2 ...

  7. WEB上传大文件解决方案

    众所皆知,web上传大文件,一直是一个痛.上传文件大小限制,页面响应时间超时.这些都是web开发所必须直面的. 本文给出的解决方案是:前端实现数据流分片长传,后面接收完毕后合并文件的思路.下面贴出简易 ...

  8. FTP上传和WEB上传的区别

       说区别之前,咱先说说什么是上传?上传就是将信息从个人计算机(本地计算机)传递到中央计算机(远程计算机)系统上,让网络上的人都能看到.将制作好的网页.文字.图片等发布到互联网上去,以便让其他人浏览 ...

  9. React实战之Ant Design—Upload上传_附件上传

    React实战之Ant Design—Upload上传_附件上传 Upload组件大家都在官方文档中看过了,但写的时候还是会遇到许多问题,一些新手看了文档后感觉无从下手,本文过多的简绍就不说了,直接看 ...

随机推荐

  1. BroadcastReceiver应用详解——广播

    转自:http://blog.csdn.net/liuhe688/article/details/6955668 BroadcastReceiver也就是“广播接收者”的意思,顾名思义,它就是用来接收 ...

  2. struts2 页面向Action传参方式

    1.基本属性注入 我们可以直接将表单数据项传递给Action,而Action只需要提供基本的属性来接收参数即可,这种传参方式称为基本属性注入.例如 jsp页面: <s:form method=& ...

  3. LoadRunner+Android模所器实现抓包并调试本地服务端

    步骤就是 1:新建LR脚本.协议选择Mobile Application - HTTP/HTML 2:在record里选择第三个:Record Emulator........ 3:  选择下一步后, ...

  4. android的五大布局(layout)

    Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建 筑里的砖瓦.组件按照布局的要求依次排列,就组成了用户所看见的界面.Android的五大布局分别是LinearLa ...

  5. Linux命令-网络命令:lastlog

    last 显示所有用户最后登录信息(会显示系统用户) last -u 只看某一个用户wangyunpeng的最后登录信息 last -u 查看系统用户root的最后登录信息 root用户的ID是0.从 ...

  6. CentOS源码编译安装Nginx

    安装编译用到的软件: yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel 现在到http://nginx.o ...

  7. jcifs 具体解释读取网络共享文件数据

    时隔1年半,没有发过新的帖子了,也没怎么来过CSDN逛逛了,人也懒散了. 今天收到网友的提问,才回来看看.认为应该再写点什么出来.只是.发现自己研究是不是太深入,写不出那么高深的东西.那就写点肤浅的东 ...

  8. Atitit。 沉思录 与it软件开发管理中的总结 读后感

    Atitit. 沉思录 与it软件开发管理中的总结 读后感 1. <沉思录>,古罗马唯一一位哲学家皇帝马可·奥勒留所著 2 2. 沉思录与it软件开发管理中的总结 2 2.1. 要有自己的 ...

  9. c++ friend 遇到 namespace 无法访问 private 成员的问题

    相关的文章(比较有意思,记录一下):http://www.cnblogs.com/lx20030303/archive/2012/09/21/2696258.html 先看例子.如下. 尝试编译的话, ...

  10. winform播放音乐

    string sound = Application.StartupPath +@"\song\123.wav"; //Application.StartupPath:程序exe所 ...