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


C# IStText.InsertNewTextPara方法代码示例

本文整理汇总了C#中IStText.InsertNewTextPara方法的典型用法代码示例。如果您正苦于以下问题:C# IStText.InsertNewTextPara方法的具体用法?C# IStText.InsertNewTextPara怎么用?C# IStText.InsertNewTextPara使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IStText的用法示例。


在下文中一共展示了IStText.InsertNewTextPara方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCustomStTextValues

 // TODO: If LanguageForge allows editing paragraph styles in multi-paragraph fields, the styleForNewParas parameter
 // will need to become a list of styles, one per paragraph. At that point we might as well add the style to the LfTxtPara
 // struct, and pass a list of such structs into SetCustomStTextValues.
 public static void SetCustomStTextValues(IStText fdoStText, IEnumerable<Guid> lfGuids, IEnumerable<string> lfParaContents, int wsId, string styleForNewParas)
 {
     LfTxtPara[] lfParas = lfGuids.Zip(lfParaContents, (g, s) => new LfTxtPara { Guid=g, Contents=s }).ToArray();
     // Step 1: Delete all FDO paragraphs that are no longer found in LF
     var guidsInLf = new HashSet<Guid>(lfGuids);
     var parasToDelete = new HashSet<IStTxtPara>();
     for (int i = 0, count = fdoStText.ParagraphsOS.Count; i < count; i++)
     {
         IStTxtPara para = fdoStText[i];
         if (!guidsInLf.Contains(para.Guid))
             parasToDelete.Add(para);
     }
     // Step 2: Step through LF and FDO paragraphs *by integer index* and copy texts over, adding new paras as needed
     for (int i = 0, count = lfParas.Length; i < count; i++)
     {
         LfTxtPara lfPara = lfParas[i];
         IStTxtPara fdoPara;
         if (i >= fdoStText.ParagraphsOS.Count)
         {
             // Past the end of existing FDO paras: create new para at end
             fdoPara = fdoStText.AddNewTextPara(styleForNewParas);
         }
         else
         {
             fdoPara = fdoStText[i];
             if (fdoPara.Guid != lfPara.Guid)
             {
                 // A new para was inserted into LF at this point; duplicate that in FDO
                 fdoPara = fdoStText.InsertNewTextPara(i, styleForNewParas);
             }
         }
         fdoPara.Contents = ConvertMongoToFdoTsStrings.SpanStrToTsString(lfPara.Contents, wsId, fdoStText.Cache.WritingSystemFactory);
     }
 }
开发者ID:ermshiperete,项目名称:LfMerge,代码行数:37,代码来源:ConvertUtilities.cs

示例2: CreateParagraph

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new <see cref="IStTxtPara"/>, owned by the given <see cref="IStText"/>.
		/// Set it with data accumulated in this builder.
		/// </summary>
		/// <param name="owner">The <see cref="IStText"/> that is to own the new paragraph</param>
		/// <param name="iPos">0-based index of the position in the sequence of paragraphs where the
		/// new paragraph is to be inserted. If a paragraph is already in this position, the new
		/// paragraph will be inserted before the existing paragraph.</param>
		/// <returns>A new StTextPara whose contents are built up from the prior calls
		/// to <see cref="AppendRun"/> and whose style is set based on the current value of
		/// <see cref="ParaStylePropsProxy"/>.</returns>
		/// ------------------------------------------------------------------------------------
		public IStTxtPara CreateParagraph(IStText owner, int iPos)
		{
			// insert a new para in the owner's collection
			IStTxtPara para = owner.InsertNewTextPara(iPos, ParaStyleName);
			SetStTxtParaPropertiesAndClearBuilder(para);

			return para;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:StTxtParaBldr.cs


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