簡體   English   中英

無法從Lotus Notes中的郵件正文檢索內聯圖像

[英]unable to retrive inlines images from the mail body in Lotus Notes

我無法從Lotus Notes中的Java中檢索嵌入式圖像/屏幕截圖

document.getItemValueString('Body')

通過上述功能,我可以檢索郵件正文中可用的文本,而不是嵌入式圖像。

請提供您的建議,以便從郵件正文中檢索嵌入式圖像

提前致謝。

LSP Jyothi

首先:主體是一個NotesRichtextItem。 您將必須使用NotesRichtextItem-方法和屬性來獲取內聯圖像...(如果有的話)。

LotusScript不以任何方式處理內聯圖像。 要獲得它們,您需要:

  • 將文檔導出為XML
  • 在XML中找到代表嵌入式圖像的部分
  • 將那里的Base64編碼的值轉換為二進制格式,為此使用MimeClasss(技巧)。
  • 將數據寫入文件

這樣做涉及很多代碼。 我只是在此處發布了代碼的“關鍵”部分(未經測試,不進行語法檢查,只是作為起點):

編輯:對不起,我不是Java專家,只看到了標簽“ lotusscript”,因此我的示例是LotusScript- Code(應該與Java類似,我認為Base64-操作是用Java內置的別名,不需要使用Mime- Trick)

Dim strDxl as String
Dim strFoundBase64 as String
Dim exporter as NotesDXLExporter
Dim stream as NotesStream
Dim docConvert as NotesDocument
Dim mimeEntity as NotesMimeEntity
Set exporter = session.CreateDXLExporter
exporter.ConvertNotesBitmapsToGIF = True

strDxl = exporter.Export(document)

'- Search through strDxl and find everything that is in the following tags:
'- <gif></gif>, <gif originalformat='notesbitmap'></gif>, <jpeg></jpeg>, <png></png>
strFoundBase64 = ...'assign text between tags


'- use Mime class to convert to binary
Set docConvert = New NotesDocument( document.ParentDatabase )
Set mimeEntity = docConvert.CreateMIMEEntity
Call mimeEntity.SetContentFromBytes(strFoundBase64, "image/gif", ENC_BASE64)
'- Write result to file
Set stream = ses.CreateStream
Call stream.Open( "C:\Temp\image.gif", "binary")
Call mimeEntity.GetContentAsBytes(stream)
Call stream.Close()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM