This commit is contained in:
Kathy Ruffing 2011-05-19 13:38:10 +00:00
parent 382ec20867
commit 7e05b609f2
2 changed files with 8 additions and 14 deletions

View File

@ -31,7 +31,6 @@ namespace Volian.Print.Library
protected static float _WidthAdjust = 1; // 1 Point - adjusted to match 16-bit line wrapping. For editting it's 3.
protected static float _WidthAdjustBox = 6;
protected static float _CharsToTwips = 6; // assumes 12 char per inch
private static float _SixLinesPerInch = 12; // twips
public static float SixLinesPerInch
{
@ -44,7 +43,7 @@ namespace Volian.Print.Library
public float XOffset
{
get { return _XOffset; }
set { _XOffset = value; }
set {_XOffset = value; }
}
protected float _YOffset;
public float YOffset
@ -120,14 +119,15 @@ namespace Volian.Print.Library
//myColumnText.UseAscender = true;// Adjusts to the top of the text box.
int status = myColumnText.Go(true); // Check to see if it will fit on the page.
if (ColumnText.HasMoreText(status) && throwException)
throw (new Exception("Paragraph longer than a page"));
//throw (new Exception("Paragraph longer than a page"));
Console.WriteLine("Paragraph longer than a page");
return 792F - myColumnText.YLine; // This gives the height of the Paragraph
}
public static float GetTableWidth(PdfContentByte cb, Paragraph iParagraph)
public static float GetTableWidth(PdfContentByte cb, Paragraph iParagraph, float? maxWidth)
{
int iWidth = 128 * (int) _CharsToTwips; // maximum width in Characters
int iWidth = (int)(maxWidth ?? 72 * 8.5F);
float h = GetParagraphHeight(cb, iParagraph, iWidth);
int iWidthMax = iWidth;
int iWidthMax = iWidth; // maximum width in Characters
int iDelta = iWidth / 2;
iWidth = iWidth / 2;
while (iDelta > 0)
@ -184,7 +184,7 @@ namespace Volian.Print.Library
/// <returns></returns>
public static int ToInt(string value)
{
return ToInt(Convert.ToInt32(value));
return ToInt((int)Convert.ToSingle(value));
}
/// <summary>
/// No conversion necessary: value from a list in a string, twips -> int twips
@ -196,12 +196,6 @@ namespace Volian.Print.Library
string s = value.Split(",".ToCharArray())[i];
return ToInt(s);
}
public float AdjustToCharPosition(float position)
{
int iPosition = (int)position;
iPosition = (iPosition / (int)_CharsToTwips) * (int)_CharsToTwips;
return (float)iPosition;
}
public static string GetRtf(string text, VE_Font vFont)
{
StringBuilder rtfSB = new StringBuilder();

View File

@ -35,7 +35,7 @@ namespace Volian.Print.Library
else
Rtf = "--------------------------"; //TODO - What should this be: is this Ctrl-A?
MyFont = formatInfo.PlantFormat.FormatData.Font;
Width = sepStr.Length * _CharsToTwips + _WidthAdjust;
Width = sepStr.Length * MyFont.CharsToTwips + _WidthAdjust;
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{