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

得到上传文件的路径
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. CodeForces 390E Inna and Large Sweet Matrix(树状数组改段求段)

    树状数组仅仅能实现线段树区间改动和区间查询的功能,能够取代不须要lazy tag的线段树.且代码量和常数较小 首先定义一个数组 int c[N]; 并清空 memset(c, 0, sizeof c) ...

  2. struts 页面调用Action的指定方法并传递参数

    如果为action配置了类,那么默认就会执行Action类的excute方法,Action类的写法三种: ① public class Action1 { public String execute( ...

  3. Spark-Dependency

    1.Spark中採用依赖关系(Dependency)表示rdd之间的生成关系.Spark可利用Dependency计算出失效的RDD.在每一个RDD中都存在一个依赖关系的列表 private var ...

  4. Python 代码块左移或右移

    (就 IDE 是  PyCharm 来说) 选中代码块: 1)右移:直接 Tab 2)左移:Shift + Tab Python 对代码对齐要求很严格的. Python的对齐方式很重要,对齐方式决定了 ...

  5. unity3d世界坐标系和本地坐标系

    transform.Translate(Vector3.forware);//向着自己坐标前方 transform.Translate(Vector3.forware,Space.World);//向 ...

  6. NPOI(2.1.3)向excel中插入图片,xls文档图片插入成功,xlsx文档图片插入失败

    众所周知,NPOI对xls和xlsx两个版本的excel文档的操作并没有一个统一的支持, 程序若想兼容这两个版本的操作,必须根据excel版本分别去调用HSSF和XSSF这两套操作库, 之前一直不明白 ...

  7. C#线程同步技术(二) Interlocked 类

    接昨天谈及的线程同步问题,今天介绍一个比较简单的类,Interlocked.它提供了以线程安全的方式递增.递减.交换和读取值的方法. 它的特点是: 1.相对于其他线程同步技术,速度会快很多. 2.只能 ...

  8. 解决gremlin-dirver访问tinkerpop服务器提示序列化错误

    解决gremlin-dirver访问tinkerpop服务器提示序列化错误 问题描述 程序集成了gremlin-driver,访问远程tinkerpop服务器,在执行创建节点操作时,返回如下错误栈: ...

  9. php 获取客户端的浏览器信息

     就是访问的时候,通过服务端来判断用户是否为移动端,如果是的话就重定向(移动端的页面).事实上现在都是一套搞定的了. 但是还是记录一下吧.没准以后用的到   http://detectmobilebr ...

  10. idea lib下有jar包但是仍然报错 找不到类

    现象: idea lib下有jar包但是仍然报错 找不到类 但是有个奇怪现象 同样的配置下项目在eclipse中可以正常编译 启动. package com.puhui.car.aspect; imp ...