From 16923fbf295ab6a68c04c82ad7be423ac267ce01 Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 9 Oct 2019 16:17:50 +0000 Subject: [PATCH] B2019-153 Get Font size from the beginning of the selection if the font size for the entire selection is invalid (999999) (Mixed font sizes) --- .../frmImportWordContents.cs | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Controls.Library/frmImportWordContents.cs b/PROMS/Volian.Controls.Library/frmImportWordContents.cs index 853127b3..d7b8773b 100644 --- a/PROMS/Volian.Controls.Library/frmImportWordContents.cs +++ b/PROMS/Volian.Controls.Library/frmImportWordContents.cs @@ -201,7 +201,10 @@ namespace Volian.Controls.Library private void CopyWordText() { // B2019-108 Display Font Size - lblFS.Text = _WordApp.Selection.Font.Size.ToString() + "Pts"; + // B2019-153 Get Font size from the beginning of the selection if the font size + // for the entire selection is invalid (999999) (Mixed font sizes) + + lblFS.Text = GetFontSize() + " Pts"; txvStyle.Text = _WordApp.Selection.Style.NameLocal; txbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString(); tbxNumber.Text = _WordApp.Selection.Range.ListFormat.ListString; @@ -234,6 +237,29 @@ namespace Volian.Controls.Library _WordApp.Activate(); } + // B2019-153 Get Font size from the beginning of the selection if the font size + // for the entire selection is invalid (999999) (Mixed font sizes) + + private string GetFontSize() + { + try + { + float retval = _WordApp.Selection.Font.Size; + if (retval > 14) + { + LBRange rng = _WordApp.Selection.Range; + rng.End = rng.Start; + retval = rng.Font.Size; + if (retval > 14) + retval = 12; + } + return retval.ToString(); + } + catch (Exception ex) + { + return "12"; + } + } // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content private string ShowText(string txt) {