当前位置: 首页>>代码示例>>C#>>正文


C# IScripture.FindStyle方法代码示例

本文整理汇总了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;
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:37,代码来源:DataStoreInitializationServices.cs


注:本文中的IScripture.FindStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。