- Fixed Header for EquipmentWBlank

- Aligned Tables properly
- Skip Section Title
- Calculated Table Width
- Fixed ChangeBar logic
- Added Text and Debug layers
- Adedd debug output to PDF
- Changed Paginate logic
- Adedd debug output to PDF
- Move GetParagraphHeight
- Added GetTableWidth
- Added ChangeBar Properties
- Added Debug and Text layers
Removed fixed override color for SVG
Removed simple PageBreak
This commit is contained in:
Rich
2010-05-25 16:15:26 +00:00
parent 9cc6174ad1
commit b00005780b
7 changed files with 249 additions and 54 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.Drawing;
using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library;
namespace Volian.Print.Library
@@ -71,10 +72,41 @@ namespace Volian.Print.Library
get
{
if (_Height == 0)
_Height = Rtf2Pdf.GetParagraphHeight(MyContentByte, IParagraph, Width);
_Height = GetParagraphHeight(MyContentByte, IParagraph, Width);
return _Height;
}
}
public static float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, float width)
{
return GetParagraphHeight(cb, iParagraph, width, true);
}
public static float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException)
{
ColumnText myColumnText = new ColumnText(cb);
myColumnText.SetSimpleColumn(0, 792F, width, 0); // Bottom margin
myColumnText.AddElement(iParagraph);
//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"));
return 792F - myColumnText.YLine; // This gives the height of the Paragraph
}
public static float GetTableWidth(PdfContentByte cb, Paragraph iParagraph)
{
int iWidth = 128 * (int) _CharsToTwips; // maximum width in Characters
float h = GetParagraphHeight(cb, iParagraph, iWidth);
int iWidthMax = iWidth;
int iDelta = iWidth / 2;
iWidth = iWidth / 2;
while (iDelta > 0)
{
float h2 = GetParagraphHeight(cb, iParagraph, iWidth,false);
iDelta = iDelta / 2;
if (h2 == h) iWidthMax = iWidth;
iWidth += (h2>h ? 1: -1) * iDelta;
}
return (float) iWidthMax;
}
private PdfContentByte _MyContentByte;
public PdfContentByte MyContentByte
{
@@ -330,7 +362,8 @@ namespace Volian.Print.Library
if (bxIndx != null)
{
Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
XOffset += (float)bx.TxtStart + tabWidth + XOffsetBox;
//XOffset += (float)bx.TxtStart + tabWidth + XOffsetBox;
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox;
if (myTab!=null)myTab.XOffset = XOffset - tabWidth;
}
else if (itemInfo.IsHigh)
@@ -371,6 +404,10 @@ namespace Volian.Print.Library
{
Width = MyParent.Width;
}
else if (itemInfo.IsTablePart)
{
Width = 72*7; // TODO: Need to determine the Width of the Table based upon the contents
}
else
{
Width = MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
@@ -473,8 +510,8 @@ namespace Volian.Print.Library
public partial class vlnBox : vlnPrintObject
{
private int _LineType; /* how to represent?? */
private Color _Color;
public Color Color
private System.Drawing.Color _Color;
public System.Drawing.Color Color
{
get { return _Color; }
set { _Color = value; }