///
" ); _builder.Append( HTMLEncode( para.QuotePrefix ) ); for( int q = 0; q < para.QuoteLevel; q++ ) { _builder.Append( ">" ); } _builder.Append( " | " );
_quoteRowStarted = true;
}
else
_builder.Append( " " ); if ( para.Type == ParagraphType.Fixed ) { _builder.Append( converter.ConvertLinks( ReplaceSpaces( HTMLEncode( para.Text ), noWrap ) ) ); } else { // show an extra separator line above and below every quoted // plain-text paragraph if ( i > 0 ) { MailBodyParser.Paragraph prevPara = parser.GetParagraph( i-1 ); if ( prevPara.Type != ParagraphType.Plain && prevPara.QuoteLevel == para.QuoteLevel && prevPara.QuotePrefix == para.QuotePrefix ) { _builder.Append( " " ); } } _builder.Append( converter.ConvertLinks( HTMLEncode( para.Text ) ) ); _builder.Append( " " ); } } else { CloseOpenElements(); switch( para.Type ) { case ParagraphType.Plain: _builder.Append( " " ); if ( para.OutlookQuote ) { _builder.Append(""); _builder.Append( converter.ConvertLinks( HTMLEncode( para.Text ) ) ); _builder.Append(""); } else { _builder.Append( converter.ConvertLinks( HTMLEncode( para.Text ) ) ); } _builder.Append( " \r\n" ); break; case ParagraphType.Fixed: case ParagraphType.Service: if ( para.OutlookQuote ) { _builder.Append(""); _builder.Append( converter.ConvertLinks( ReplaceSpaces( HTMLEncode( para.Text ), noWrap ) ) ); _builder.Append(""); } else { _builder.Append( converter.ConvertLinks( ReplaceSpaces( HTMLEncode( para.Text ), noWrap ) ) ); } _builder.Append( "\r\n" ); break; case ParagraphType.Sig: _builder.Append( "" ); _builder.Append( converter.ConvertLinks( para.Text ) ); _builder.Append( "" ); break; } } oldQuoteLevel = para.QuoteLevel; oldQuotePrefix = para.QuotePrefix; } CloseOpenElements(); _builder.Append( " "); } /// |
" + HttpUtility.HtmlEncode( body ) + ""; } else { MailBodyParser replyParser = new MailBodyParser( replyToBody, minWrapWidth ); MailBodyParser parser = new MailBodyParser( body, minWrapWidth, replyParser ); text = MailBodyFormatter.FormatBody( parser, subject, false, injector, fontFace, fontSize ); } return text; } private static void GetTexts( IResource res, int bodyProp, int replyLink, out string body, out string origBody ) { body = res.GetPropText( bodyProp ); IResource origRes = res.GetLinkProp( replyLink ); origBody = (origRes != null) ? origRes.GetPropText( bodyProp ) : null; } public string GetFormattedHtmlBody( IResource res, string body, ref WordPtr[] offsets ) { string formattedText; string subject = res.GetPropText( Core.Props.Subject ); // If no offsets passed, default to the simple processing if(( offsets == null ) || ( offsets.Length == 0 )) { formattedText = InsertHeaderWithStyle( body, subject ); } else { // Save offsets, format text, retrieve offsets. using( MarkerInjector injector = new MarkerInjector() ) { WordPtr[] modOffs = DocumentSection.RestrictResults( offsets, DocumentSection.BodySection ); body = injector.InjectMarkers( body, modOffs ); formattedText = InsertHeaderWithStyle( body, subject ); formattedText = injector.CollectMarkers( formattedText, out modOffs ); } } return formattedText; } private static string InsertHeaderWithStyle( string text, string subject ) { string formattedText = text; if( !string.IsNullOrEmpty( subject ) ) { string formattedTitle = FormattedHeaderWithStyle( subject ); int index = text.IndexOf( "", StringComparison.InvariantCultureIgnoreCase ); if( index != -1 ) { formattedText = text.Substring( 0, index + 6 ) + formattedTitle + text.Substring( index + 6 ); } else { formattedText = formattedTitle + text; } } return formattedText; } public string StandardStyledHeader( string subject ) { return FormattedHeader( subject ); } internal static string FormattedHeader( string subject ) { return "