當前位置: 首頁>>代碼示例>>C#>>正文


C# Chunk.HasAttributes方法代碼示例

本文整理匯總了C#中iTextSharp.text.Chunk.HasAttributes方法的典型用法代碼示例。如果您正苦於以下問題:C# Chunk.HasAttributes方法的具體用法?C# Chunk.HasAttributes怎麽用?C# Chunk.HasAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.Chunk的用法示例。


在下文中一共展示了Chunk.HasAttributes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddChunk

     /// <summary>
     /// Adds a Chunk.
     /// </summary>
     /// <remarks>
     /// This method is a hack to solve a problem I had with phrases that were split between chunks
     /// in the wrong place.
     /// </remarks>
     /// <param name="chunk">a Chunk</param>
     /// <returns>a bool</returns>
     protected bool AddChunk(Chunk chunk) {
 	    Font f = chunk.Font;
 	    String c = chunk.Content;
         if (font != null && !font.IsStandardFont()) {
             f = font.Difference(chunk.Font);
         }
         if (Count > 0 && !chunk.HasAttributes()) {
             try {
                 Chunk previous = (Chunk) this[Count - 1];
                 if (!previous.HasAttributes()
                         && (f == null
                         || f.CompareTo(previous.Font) == 0)
                         && previous.Font.CompareTo(f) == 0
                         && !"".Equals(previous.Content.Trim())
                         && !"".Equals(c.Trim())) {
                     previous.Append(c);
                     return true;
                 }
             }
             catch {
             }
         }
         Chunk newChunk = new Chunk(c, f);
         newChunk.Attributes = chunk.Attributes;
         if (hyphenation != null && newChunk.GetHyphenation() == null && !newChunk.IsEmpty()) {
             newChunk.SetHyphenation(hyphenation);
         }
         base.Add(newChunk);
         return true;
     }
開發者ID:pusp,項目名稱:o2platform,代碼行數:39,代碼來源:Phrase.cs

示例2: AddChunk

 private bool AddChunk(Chunk chunk)
 {
     if (!font.IsStandardFont()) {
         chunk.Font = font.Difference(chunk.Font);
     }
     if (Count > 0 && !chunk.HasAttributes()) {
         try {
             Chunk previous = (Chunk) this[Count - 1];
             if (!previous.HasAttributes() && previous.Font.CompareTo(chunk.Font) == 0 && !"".Equals(previous.Content.Trim()) && !"".Equals(chunk.Content.Trim())) {
                 previous.Append(chunk.Content);
                 return true;
             }
         }
         catch {
         }
     }
     base.Add(chunk);
     return true;
 }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:19,代碼來源:Phrase.cs


注:本文中的iTextSharp.text.Chunk.HasAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。