Implement code for DontResetIndentOnNewline for BGE

This commit is contained in:
Kathy Ruffing 2015-01-16 15:02:06 +00:00
parent 18e7dbcdad
commit 1b0079388e

View File

@ -65,6 +65,12 @@ namespace Volian.Print.Library
} }
} }
} }
private bool _HasIndent = false;
public bool HasIndent
{
get { return _HasIndent; }
set { _HasIndent = value; }
}
private string _ImageText; // ro definition, value part of #Link in case of image/figure private string _ImageText; // ro definition, value part of #Link in case of image/figure
public string ImageText public string ImageText
{ {
@ -84,7 +90,7 @@ namespace Volian.Print.Library
{ {
if (_IParagraph == null) if (_IParagraph == null)
{ {
_IParagraph = RtfToParagraph(Rtf); _IParagraph = RtfToParagraph(Rtf, HasIndent);
} }
return _IParagraph; return _IParagraph;
} }
@ -335,8 +341,20 @@ namespace Volian.Print.Library
} }
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf) public static iTextSharp.text.Paragraph RtfToParagraph(string rtf)
{ {
return RtfToParagraph(rtf, false);
}
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf, bool hasIndent)
{
if (hasIndent)
{
hasIndent = rtf.Contains("\x05");
if (hasIndent && rtf.Contains(@"\par \par")) rtf = rtf.Replace(@"\par \par", @"\par \u160? \par");
if (hasIndent && rtf.Contains(@"\par\par")) rtf = rtf.Replace(@"\par\par", @"\par \u160? \par");
}
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf); IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc); Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc);
rtf2IText.HasIndent = hasIndent;
iTextSharp.text.Paragraph para = rtf2IText.Convert(); iTextSharp.text.Paragraph para = rtf2IText.Convert();
para.SetLeading(_SixLinesPerInch, 0); para.SetLeading(_SixLinesPerInch, 0);
if (rtf.Contains("\x05")) if (rtf.Contains("\x05"))