问题描述
在IBMLotusNotes可使用File-Export导出NotesDocument为msrtf,如下图:我尝试使用LotusC++api实现这一功能,部分代码如下:try{session.Init();session.GetDatabase("RTFCon.nsf",&db,"mycom");if(!db.IsOpen()){db.Open();//Openthedatabase}db.GetDocuments(&docArr);count=docArr.GetCount();for(index=0;index<count;index++){curDoc=docArr[index];curDoc.Open();if(curDoc.HasItem("$Body")){curDoc.GetItem("$Body",&rt);}rt.GetCursor(&startCursor);rt.GetEndCursor(&endCursor);rt.Export("c:\test.rtf",startCursor,endCursor,"RTF");}db.Close();//}catch(LNSTATUSerror){charerrorBuf[LNERROR_MESSAGE_LENGTH];LNGetErrorMessage(error,errorBuf);cout<<"Error:"<<errorBuf<<endl;}打开test.rtf如图:对比发现了少了MainTopic以及下面附件图标等信息,在我的代码中我只获取body的richtext进行export导致部分数据丢失,但是同时又无法以NotesDocument为对象获取richtext进而进行export。网上找到该代码类似于我所实现的功能,代码如下:OptionPublicOptionExplicitConstAPIModule="NNOTES"DeclareFunctionMailGetMessageBodyCompositeLibAPIModuleAlias"MailGetMessageBodyComposite"(ByvalhNTAsLong,ByvalNAsString,ByvalDAsString,nDAsLong)AsIntegerDeclareFunctionExportRTFLib"nxrtf"Alias"ExportRTF"(ByvalsTempFileAsString,ByvalflagsAsLong,hmodAsLong,ByvalaltlibraryAsString,ByvalsRTFFileAsString)AsIntegerSubInitializeConstworkdir="c:temp"ConstOutputName=workdir&"Message_Body.rtf"ConsttempRTF=workdir&"rtf.cd"ConsttempFONTS=workdir&"fonts.cd"ConsttempBODY=workdir&"body.fcd"DimsessionAsNewnotessessionDimdbAsnotesdatabaseDimdcAsnotesdocumentcollectionDimdocAsnotesdocumentDimrtBodyAsnotesrichtextitemDimfileSizeAsLongDimdocnumAsIntegerDimprocessAsIntegerSetdb=session.CurrentdatabaseSetdc=db.Unprocesseddocuments'WritetheBodyfieldouttoafileinCDformatCallMailGetMessageBodyComposite(Doc.handle,"Body",tempRTF,fileSize)'Writethe$fontsfieldouttoafileinCDformatCallMailGetMessageBodyComposite(Doc.handle,"$Fonts",tempFONTS,fileSize)'JointhetwointooneCDfile,strippingoffcontrolwordfromsecondfile.Callconcatenate(tempRTF,tempFONTS,tempBODY)'TakeCDfileandcallDLLusedbyclientFile|ExporttocreateRTFfileCallExportRTF(tempBODY,0,0,"",OutputName)KilltempRTFKilltempFONTSKilltempBODYSetrtBody=doc.getfirstitem("Body")Callrtbody.AddNewLine(1)CallrtBody.EmbedObject(EMBED_ATTACHMENT,"",OutputName,"")KillOutputNameCalldoc.Save(False,False)NextEndSubSubconcatenate(fileIn1AsString,fileIn2AsString,fileOut1AsString)'TakestwoCDrecordformatfilesandaddsthemintoonefileusingbinaryfileaccess'Firsttwobytes(oneword)offileiscontrolcharactersothisisstrippedfromsecondfile'thereisalwaysevennumberofbytesinCD-recordssowecanuseIntegersotransferthedataDimtwobytesAsIntegerDimfileinAsIntegerDimfileoutAsIntegerfileout=FreefileOpenfileOut1ForBinaryAs#fileoutfilein=FreefileOpenfileIn1ForBinaryAs#fileinDoUntilEof(filein)Get#filein,,twobytesPut#fileout,,twobytesLoopClose#fileinOpenfileIn2ForBinaryAs#fileinSeek#filein,3DoUntilEof(filein)Get#filein,,twobytesPut#fileout,,twobytesLoopCloseEndSub大概可见是采用分别导出Body,$Font为cd文件进而合并为一个文件,然后采用api进行convert,我并未尝试该代码是否可用以及导出结果是否等同于File-Export。
解决方案
解决方案二:
[img=http://picasaweb.google.com/workWang/Else/photo#5236100415186189074][/img]图片太小,补发[img=http://picasaweb.google.com/workWang/Else/photo#5236100411362709202][/img]
解决方案三:
解决方案四:
解决方案五:
为什么我用这个方法(第一种),无法将引入的gif图片导出来,bmp的图片到出来后也变成了黑白色?
解决方案六:
你的notes版本是6.5以上的吧?引用4楼zhaoyifang的回复:
为什么我用这个方法(第一种),无法将引入的gif图片导出来,bmp的图片到出来后也变成了黑白色?
解决方案七:
是的
解决方案八:
对于高版本的lotus存在这个问题,目前我还没有解决办法。引用6楼zhaoyifang的回复:
是的
解决方案九:
如果是多个tif图片用第一种方法能导出来吗