protected override IRichTextString BuildRTFOdds(RTFHelper rtfHelper) { string odds = Template.odds; var rtfNumberRenderer = new RTFNumber(rtfHelper.RTFRenderer, rtfHelper.PosFont, rtfHelper.NegFont); rtfNumberRenderer.Render(odds); var rtfOdds = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return rtfOdds; }
/// <summary> /// Builds the RTF odds. /// </summary> /// <param name="rtfHelper">The RTF helper.</param> /// <returns>IRichTextString object.</returns> protected override IRichTextString BuildRTFOdds(RTFHelper rtfHelper) { if (Template.odds == "-") { return new HSSFRichTextString("-"); } int breakPos = Template.odds.IndexOf("<br>"); string oddsWinString = Template.odds.Substring(0, breakPos); string oddsPlaceString = Template.odds.Replace(oddsWinString, string.Empty); string oddsWinVal = ExtractStringBetweenTag("b", oddsWinString); string oddsPlaceVal = ExtractStringBetweenTag("b", oddsPlaceString); var rtfNumberRenderer = new RTFNumber(rtfHelper.RTFRenderer, rtfHelper.PosFont, rtfHelper.NegFont); // Add Win rtfHelper.RTFRenderer.AddText(string.Join(null, new string[] { CoreBetList.win, ": " }), rtfHelper.PosFont); rtfNumberRenderer.Render(oddsWinVal); // Add Place rtfHelper.RTFRenderer.AddText(string.Join(null, new string[] { "\n", CoreBetList.place, ": " }), rtfHelper.PosFont); rtfNumberRenderer.Render(oddsPlaceVal); var rtfOdds = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return rtfOdds; }
/// <summary> /// Builds the RTF odds. /// </summary> /// <param name="rtfHelper">The RTF helper.</param> /// <returns>IRichTextString represents excel-formatted Odds string.</returns> protected virtual IRichTextString BuildRTFOdds(RTFHelper rtfHelper) { string odds = Template.odds; var rtfNumberRenderer = new RTFNumber(rtfHelper.RTFRenderer, rtfHelper.PosFont, rtfHelper.NegFont); rtfNumberRenderer.Render(odds); if (!string.IsNullOrEmpty(Template.oddsType)) { odds = "\n" + Template.oddsType; rtfHelper.RTFRenderer.AddText(odds, rtfHelper.PosFont); } var rtfOdds = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return rtfOdds; }