Domino移动Web上传的附件到RichText域
只是从网上拷贝下来,没有测试。
得到上传文件的路径
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域的更多相关文章
- 文件批量上传-统一附件管理器-在线预览文件(有互联网和没有两种)--SNF快速开发平台3.0
实际上在SNF里使用附件管理是非常简单的事情,一句代码就可以搞定.但我也要在这里记录一下统一附件管理器能满足的需求. 通用的附件管理,不要重复开发,调用尽量简洁. 批量文件上传,并对每个文件大小限制, ...
- 前端之web上传文件的方式
前端之web上传文件的方式 本节内容 web上传文件方式介绍 form上传文件 原生js实现ajax上传文件 jquery实现ajax上传文件 form+iframe构造请求上传文件 1. web上传 ...
- 第九篇:web之前端之web上传文件的方式
前端之web上传文件的方式 前端之web上传文件的方式 本节内容 web上传文件方式介绍 form上传文件 原生js实现ajax上传文件 jquery实现ajax上传文件 form+iframe构 ...
- 关于confluence上传文件附件预览查看时出现乱码的问题解决办法
在confluence上传excel文件,预览时发现乱码问题主要是因为再上传文件的时候一般是Windows下的文件上传,而预览的时候,是linux下的环境,由于linux下没有微软字体,所以预览的时候 ...
- confluence上传文件附件预览乱码问题(linux服务器安装字体操作)
在confluence上传excel文件,预览时发现乱码问题主要是因为再上传文件的时候一般是Windows下的文件上传,而预览的时候,是linux下的环境,由于linux下没有微软字体,所以预览的时候 ...
- Web上传文件的原理及实现
现在有很多Web程序都有上传功能,实现上传功能的组件或框架也很多,如基于java的Commons FileUpload.还有Struts1.x和Struts2中带的上传文件功能(实际上,Struts2 ...
- WEB上传大文件解决方案
众所皆知,web上传大文件,一直是一个痛.上传文件大小限制,页面响应时间超时.这些都是web开发所必须直面的. 本文给出的解决方案是:前端实现数据流分片长传,后面接收完毕后合并文件的思路.下面贴出简易 ...
- FTP上传和WEB上传的区别
说区别之前,咱先说说什么是上传?上传就是将信息从个人计算机(本地计算机)传递到中央计算机(远程计算机)系统上,让网络上的人都能看到.将制作好的网页.文字.图片等发布到互联网上去,以便让其他人浏览 ...
- React实战之Ant Design—Upload上传_附件上传
React实战之Ant Design—Upload上传_附件上传 Upload组件大家都在官方文档中看过了,但写的时候还是会遇到许多问题,一些新手看了文档后感觉无从下手,本文过多的简绍就不说了,直接看 ...
随机推荐
- Python进阶---python strip() split()函数实战(转)
先看一个例子: >>> ipaddr = 10.122.19.10 File "", line 1 ipaddr = 10.122.19.10 ^ SyntaxE ...
- linux 下远程连接mysql命令详解
http://hi.baidu.com/aaxh/blog/item/49bcb78ffe3dfae4f01f36b2.html一.MySQL 连接本地数据库,用户名为“root”,密码“123”(注 ...
- 异常:Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z/Caused by: java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreign
Spring3.0 + Hibernate3.5:启动服务器报:Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToMany. ...
- 采集Snoopy.class.php
<?php /************************************************* Snoopy - the PHP net client Author: Mont ...
- AES + RSA + Hash 实现 C-S 安全交互
概述 AES 由于其执行速度快,易于硬件实现,破解难度大等优势,被广泛用于数据的加密. 既然是对称加密,那如何保证秘钥的安全传输?很容易想到用 RSA 加密秘钥.由于只能用私钥解密,而私钥不需要交互双 ...
- [gj]来公司停电了-维护机器
停电出现的问题 一早来机房跳闸了. 很多vm手动起来后有些服务不太正常了. 机房锁坏了.不知道谁进去干啥了.导致跳闸 闸门不知道在哪里.导致所有机器停电了 牵扯到的技术点: 1,nexus启动. ng ...
- HashMap 内部原理
HashMap 内部实现 通过名字便可知道的是,HashMap 的原理就是散列.HashMap内部维护一个 Buckets 数组.每一个 Bucket 封装为一个 Entry<K, V> ...
- PHP进制转换[实现2、8、16、36、64进制至10进制相互转换]
自己写了一个PHP进制转换程序,一个类吧,第一次写这个东东,写这个东东,在处理文本文件时能用得到. 可以实现: 10进制转换2.8.16.36.62进制2.8.16.36.62进制转换10进制 有 ...
- 7-16 Bestcoder a Oracle
Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submissio ...
- linux2.6内核netfilter架构分析
1.2.6内核的netfilter与2.4的有很大不同: ChangeLog-2.6.15 中有下面这样的描述: commit 9fb9cbb1082d6b31fb45aa1a14432449a0df ...