B2018-034 Use _IParagraph when PDF Link info is added
B2018-034 Copy the attributes from old to new when IParagraph is refreshed (IsCompressed)
This commit is contained in:
@@ -106,7 +106,10 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
iTextSharp.text.Paragraph _IParagraph;
|
||||
// B2018-034 Attributes were being lost when the IsCompressed flag was true.
|
||||
// The following variable was changed to a public so that it could be used
|
||||
// for setting PDF Links without creating IParagraph when IsCompressed was true.
|
||||
public iTextSharp.text.Paragraph _IParagraph;
|
||||
public iTextSharp.text.Paragraph IParagraph
|
||||
{
|
||||
get
|
||||
@@ -124,13 +127,35 @@ namespace Volian.Print.Library
|
||||
myRtf= myRtf.Replace(@"\line \line ", @"\line \u160? \line ");
|
||||
if (myRtf.Contains(@"\pard\line ")) // Bug fix: B2016-145 for VC.Summer End Message
|
||||
myRtf = myRtf.Replace(@"\pard\line ", @"\par ");
|
||||
// B2018-034 Attributes were being lost when the IsCompressed flag was true.
|
||||
// CopyAttributesToNewIParagraph retains any attribute which have been set
|
||||
Paragraph oldParagraph = _IParagraph;
|
||||
_IParagraph = RtfToParagraph(myRtf, HasIndent);
|
||||
// B2018-034 Attributes were being lost when the IsCompressed flag was true.
|
||||
// CopyAttributesToNewIParagraph retains any attribute which have been set
|
||||
CopyAttributesToNewIParagraph(oldParagraph, _IParagraph);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
return _IParagraph;
|
||||
}
|
||||
set { _IParagraph = value; }
|
||||
}
|
||||
// B2018-034 Attributes were being lost when the IsCompressed flag was true.
|
||||
// CopyAttributesToNewIParagraph retains any attribute which have been set
|
||||
private void CopyAttributesToNewIParagraph(Paragraph oldParagraph, Paragraph newParagraph)
|
||||
{
|
||||
if (oldParagraph == null) return;
|
||||
if (oldParagraph.Chunks.Count != newParagraph.Chunks.Count) return;
|
||||
for (int i = 0; i < oldParagraph.Chunks.Count; i++)
|
||||
{
|
||||
System.Collections.Hashtable oldTable = (oldParagraph.Chunks[i] as Chunk).Attributes;
|
||||
System.Collections.Hashtable newTable = (newParagraph.Chunks[i] as Chunk).Attributes;
|
||||
if (oldTable.Count == newTable.Count) return;
|
||||
foreach (System.Collections.DictionaryEntry de in oldTable)
|
||||
if (!newTable.ContainsKey(de.Key))
|
||||
newTable.Add(de.Key, de.Value);
|
||||
}
|
||||
}
|
||||
private float _Width;
|
||||
public float Width
|
||||
{
|
||||
|
Reference in New Issue
Block a user