本文整理汇总了C#中IScripture.FindStyle方法的典型用法代码示例。如果您正苦于以下问题:C# IScripture.FindStyle方法的具体用法?C# IScripture.FindStyle怎么用?C# IScripture.FindStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScripture
的用法示例。
在下文中一共展示了IScripture.FindStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureStylesInUseSetForPara
/// ------------------------------------------------------------------------------------
/// <summary>
/// Ensures that all styles that are used in the specified paragraph are marked as InUse
/// </summary>
/// <param name="para">The paragraph to scan for used styles.</param>
/// <param name="scr">Scripture.</param>
/// ------------------------------------------------------------------------------------
private static void EnsureStylesInUseSetForPara(IScrTxtPara para, IScripture scr)
{
IStStyle paraStyle = scr.FindStyle(para.StyleName);
if (paraStyle == null)
{
para.StyleName = para.DefaultStyleName;
paraStyle = scr.FindStyle(para.StyleName);
}
((StStyle)paraStyle).InUse = true;
ITsString paraContents = para.Contents;
for (int iRun = 0; iRun < paraContents.RunCount; iRun++)
{
string charStyleName = paraContents.get_StringProperty(iRun, (int)FwTextPropType.ktptNamedStyle);
if (!string.IsNullOrEmpty(charStyleName))
{
IStStyle charStyle = scr.FindStyle(charStyleName);
if (charStyle == null)
{
// FWR-2594: Converted FW 6.0 project can contain runs with styles that were deleted
// cleanest fix was to recreate the missing style and allow the user to clean up the text
// later.
Logger.WriteEvent("EnsureStylesInUseSetForPara: Deleted style (" + charStyleName + ") still in use, recreated it.");
charStyle = para.Cache.ServiceLocator.GetInstance<IStStyleFactory>().Create(scr.StylesOC, charStyleName,
ContextValues.General, StructureValues.Undefined, FunctionValues.Prose, true, 0, false);
}
((StStyle)charStyle).InUse = true;
}
}
}