如何使用lotusscript将文档中的文本和富文本字段转换为html?
我只是想知道如何将数据库中上传的文档中的文本和富文本字段转换为 html 字段。
i just wanted to know how can i convert text and rich text fields in a document uploaded in a database to html fields.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
知道我在某处看到过它:
nsftools.com 来救援
核心诀窍是将内容保存为 MIMEParts。
示例代码已有 5 年历史,是为 R6 设计的,但 Notes 具有相当好的向后兼容性。我也有个人经验,从 MIME 到 RichText 的其他方式很简单,所以您应该没问题。
对于普通文本字段,您可能希望将其内容复制到富文本字段或使用上述链接中的功能来呈现整个文档。
Knew I'd seen it somewhere:
nsftools.com to the rescue
The core of the trick is to save the content as MIMEParts.
The sample code is 5 years old and was designed for R6 but Notes has pretty good backwards compatibility. I've also had personal experience that going the other way from MIME to RichText is straightforward so you should be ok.
For the normal text fields you may want to copy their content to a rich text field or use the feature from the above link that allows you to render entire documents.
我认为在 LotusScript 中不可能真正做到这一点。但在 Java 代理中,您可以向 Domino 服务器发出 http 请求,这基本上会强制服务器执行其渲染工作。然后,您可以捕获生成的 html 并将其存储回同一个文档或不同的文档中,等等。
如果您只想在渲染中使用特定的文本/富文本字段,只需设置一种特殊的表单来进行转换,并使用精确的格式进行转换。所需的布局和字段。然后,创建包含所有文档的视图,并添加表单公式以确保使用此新表单。然后,您可以在创建的 URL 中引用该视图来呈现每个文档。
Java 代理中的代码将如下所示:
I don't think its possible to really do this in lotusscript. But in a Java agent, you can make an http request to the Domino server, which basically forces the server to do its rendering work. Then, you can capture the resulting html and store this back into the same document, or a different one, etc.
If you only want particular text/rich text fields in the rendering, just set up a special form for the conversion with the exact layout and fields desired. Then, create a view with all documents, and add a form formula to ensure that this new form is used. Then, you can reference that view in the URL you create to render each document.
The code in your Java agent would be something like this: