本文整理汇总了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;
}
示例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;
}