【发布时间】:2014-08-26 13:23:08
【问题描述】:
我有一个 xpage,其中包含一个按钮,该按钮从多个字段中提取值、格式化文本并将该值设置为后端文档上的富文本字段并保存它。
当我在注释端打开文档时,即使字段类型表明它是文本,该字段的格式也正确。当我在浏览器中打开文档时,所有格式都会丢失,文本是一个连续的字符串。如果我运行包含 @Command([ToolsRefreshSelectedDocs]) 的代理,则该字段将转换为 Richtext,并且 xpage 会正确显示内容以及 Notes 文档。
在从网络上保存文档时,我是否可以设置值并保留格式或刷新文档以格式化内容?
按钮示例代码
var val;
var surveystandard = getComponent("FStandard").value;
var totalspaces = getComponent("TotalSpaces").value;
....
//Parking
if (!!totalspaces){
val = val + "\n";
val = val + "PARKING" + "\n";
val = val + "\u25cf" + "\t" + "There are " + totalspaces + " parking spaces, with " + accessiblespaces + " marked accessible spaces, " + vanspaces + " of these are marked van accessible, " + carspacesrequired + " car accessible space(s) and " + vanspacesrequired + " van accessible space are required.";
val = val + "\n";
if (parking != "" && totalspaces == ""){
val = val + "PARKING" + "\n";
formattedValue = formatCustomList(parking, customparking);
val = val + formattedValue; ........
//Set value **********
document1.setValue("Notes", val);
我使用 NotesRichTextItem 尝试了几件事,但没有成功。
var notesRTF:NotesRichTextItem = document1.getDocument().createRichTextItem("Notes");
notesRTF.appendText(val);
此代码生成错误....
脚本解释器错误,line=749, col=58: [TypeError] 调用方法 NotesDocument.createRichTextItem(string) null 发生异常
脚本块完成后,会出现一个执行简单操作的“保存文档”步骤。
任何想法或建议都会很棒。
提前致谢!
【问题讨论】:
-
看我的博客条目:per.lausten.dk/blog/2012/12/…
标签: xpages