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

得到上传文件的路径
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. UIActivityViewController实现系统原生分享

    代码地址如下:http://www.demodashi.com/demo/11042.html 一.效果预览 二.接下来介绍UIActivityViewController,跟我动手做 1.创建要分享 ...

  2. Eclipse项目上红叉

    整个项目可以编译通过并且运行都没问题,但是项目上有个红叉,这个问题一般是有两个原因: 1.查看项目是不是有的引用包报错 解决办法:在项目的build path 中删除不可用引用或者修正 2.项目的编译 ...

  3. Javascript 判断网页横竖屏

    本篇文章由:http://xinpure.com/javascript-to-determine-page-anyway-screen/ Html5 流行至今,自适应的网站已经多如牛毛,但是横竖屏的切 ...

  4. T-sql for xml path使用

    用法: FOR XML PATH 方法是用于将查询结果集以XML形式展示 sql: p.ContactTypeID,p.ModifiedDate,p.Name from [Person].[Conta ...

  5. 使用css3属性transition实现页面滚动

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content ...

  6. android UI 适配小节

    一.   像素密度表 像素密度表 比如UE 给了三张切图分别对应: mdpi,     xhdpi,     xxdpi 10 * 10,     20 * 20,     30 * 30 上面的值都 ...

  7. Python 射线法判断一个点坐标是否在一个坐标区域内

    class Point: lng = '' lat = '' def __init__(self, lng, lat): self.lng = lng self.lat = lat # 求外包矩形 d ...

  8. Netty4具体解释三:Netty架构设计

         读完这一章,我们基本上能够了解到Netty全部重要的组件,对Netty有一个全面的认识.这对下一步深入学习Netty是十分重要的,而学完这一章.我们事实上已经能够用Netty解决一些常规的问 ...

  9. python DataFrame获取行数、列数、索引及第几行第几列的值

    print df.columns.size#列数 2 print df.iloc[:,0].size#行数 3 print df.ix[[0]].index.values[0]#索引值 0 print ...

  10. WebSocket遇到的一些问题

    一 .Nginx配置websocket   为了解决Nginx转发不能进行websocket通信问题 将nginx配置文件添加如下内容:   map $http_upgrade $connection ...