lib/mapi/property_set.rb
# for providing rtf to html extraction or conversion
for providing rtf to html extraction or conversion
for providing rtf to html extraction or conversion
def body_html
			return @body_html if defined?(@body_html)
			@body_html = self[:body_html]
			@body_html = @body_html.read if @body_html.respond_to?(:read)
			@body_html = nil if @body_html.to_s.strip.empty?
			if body_rtf and !@body_html
				begin
					@body_html = RTF.rtf2html body_rtf
				rescue
					Log.warn 'unable to extract html from rtf'
				end
				if !@body_html
					Log.warn 'creating html body from rtf'
					begin
						@body_html = RTF::Converter.rtf2text body_rtf, :html
					rescue
						Log.warn 'unable to convert rtf to html'
					end
				end
			end
			@body_html
		end
def body_html return @body_html if defined? ( @body_html ) @body_html = self [ :body_html ] @body_html = @body_html . read if @body_html . respond_to? ( :read ) @body_html = nil if @body_html . to_s . strip . empty? if body_rtf and ! @body_html begin @body_html = RTF . rtf2html body_rtf rescue Log . warn 'unable to extract html from rtf' end if ! @body_html Log . warn 'creating html body from rtf' begin @body_html = RTF :: Converter . rtf2text body_rtf , :html rescue Log . warn 'unable to convert rtf to html' end end end @body_html end
for providing rtf to html extraction or conversion
for providing rtf to html extraction or conversion
# sometimes body_html is a stream, and sometimes a string