リッチテキストフィールドに埋め込まれた1つ目の画像のURLを取得

// Get URL of first image file embedded in specific Rich Text field
// param:
// doc: target notes document
// strImgField: rich text field name which contains the embedded image 
function getAttachmentImageURL(doc:NotesDocument, strImgField:String){
	var strRet = "";
	try{
		var rtItem:NotesRichTextItem  = doc.getFirstItem(strImgField);
		if(rtItem !== null){
			var attachmentName = rtItem.getEmbeddedObjects().get(0).getName();	// Get first attachment image
			var webScheme = facesContext.getExternalContext().getRequest().getScheme();
			var webSrvName = facesContext.getExternalContext().getRequest().getServerName();
			var webDbName = facesContext.getExternalContext().getRequest().getContextPath();
			var url = webScheme+"://"+webSrvName+webDbName+"/xsp/.ibmmodres/domino/OpenAttachment/"+webDbName;
			strRet = url+'/'+doc.getUniversalID()+'/'+strImgField+'/'+attachmentName;
			
			rtItem.recycle();
		}
	}catch(e){
		print(e);
	}
	return strRet
}





xpages, 埋め込み画像, リッチテキスト

JavaScript (Server)
kazut
August 21, 2015 6:00 PM
Rating
0





No comments yetLogin first to comment...