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)

This commit is contained in:
Rich 2019-10-09 16:17:50 +00:00
parent bf3548fbb1
commit 16923fbf29

View File

@ -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)
{