Changed how Height and Width of grid is calculated
Preprocessed cell data to reduce number of calls to flexgrids Preprocessed RTF data to reduce calls to rich text boxes Added IsRangeStyleNull property and TextAlign property to reduce call to flexgrids Eliminated creation of multiple flexgrids but using a static flexgrid over and over
This commit is contained in:
parent
60ae2a7ca1
commit
bc69a84d33
@ -52,9 +52,15 @@ namespace Volian.Print.Library
|
|||||||
set { _MyCells = value; }
|
set { _MyCells = value; }
|
||||||
}
|
}
|
||||||
public float Height
|
public float Height
|
||||||
{ get { return RowTop[MyFlexGrid.Rows.Count]; } }
|
{ get
|
||||||
|
{
|
||||||
|
return RowTop[RowTop.Length - 1];
|
||||||
|
} }
|
||||||
public float Width
|
public float Width
|
||||||
{ get { return ColLeft[MyFlexGrid.Cols.Count]; } }
|
{ get
|
||||||
|
{
|
||||||
|
return ColLeft[ColLeft.Length - 1];
|
||||||
|
} }
|
||||||
|
|
||||||
private static float _XOffset = -1; // This moves the borders with respect to the text
|
private static float _XOffset = -1; // This moves the borders with respect to the text
|
||||||
public static float XOffset
|
public static float XOffset
|
||||||
@ -165,6 +171,16 @@ namespace Volian.Print.Library
|
|||||||
MyFlexGrid = myFlexGrid;
|
MyFlexGrid = myFlexGrid;
|
||||||
MyContentByte = myContentByte;
|
MyContentByte = myContentByte;
|
||||||
SetupCells();
|
SetupCells();
|
||||||
|
foreach(vlnCell cell in this)
|
||||||
|
{
|
||||||
|
GridLinePattern glp = cell.AboveLeftSide;
|
||||||
|
glp = cell.AboveRightSide;
|
||||||
|
glp = cell.BelowLeftSide;
|
||||||
|
glp = cell.BelowRightSide;
|
||||||
|
glp = cell.RightOfBottomSide;
|
||||||
|
glp = cell.RightOfTopSide;
|
||||||
|
object ta = cell.TextAlign;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
@ -190,18 +206,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
DisplayText dt = new DisplayText(MyFlexGrid.GetMyItemInfo(), str, false);
|
DisplayText dt = new DisplayText(MyFlexGrid.GetMyItemInfo(), str, false);
|
||||||
str = dt.StartText;
|
str = dt.StartText;
|
||||||
using (StepRTB myRTB = new StepRTB())
|
str = PreProcessRTF(w, str);
|
||||||
{
|
|
||||||
myRTB.Width = (int)w;
|
|
||||||
myRTB.Font = MyFlexGrid.Font;
|
|
||||||
if (str.StartsWith(@"{\rtf"))
|
|
||||||
myRTB.Rtf = str.Replace(@"\~", @"\u160?");
|
|
||||||
else
|
|
||||||
myRTB.Text = str;
|
|
||||||
myRTB.SelectAll();
|
|
||||||
myRTB.SelectionColor = PrintOverride.OverrideTextColor(System.Drawing.Color.Black);
|
|
||||||
str = myRTB.Rtf;
|
|
||||||
}
|
|
||||||
iTextSharp.text.Paragraph myPara = RtfToParagraph(str);
|
iTextSharp.text.Paragraph myPara = RtfToParagraph(str);
|
||||||
myColumnText1.SetSimpleColumn(0, 0, w - 2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4
|
myColumnText1.SetSimpleColumn(0, 0, w - 2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4
|
||||||
|
|
||||||
@ -226,6 +231,21 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static StepRTB _StatRTB = new StepRTB();
|
||||||
|
private string PreProcessRTF(float w, string str)
|
||||||
|
{
|
||||||
|
_StatRTB.Text = string.Empty;
|
||||||
|
_StatRTB.Width = (int)w;
|
||||||
|
_StatRTB.Font = MyFlexGrid.Font;
|
||||||
|
if (str.StartsWith(@"{\rtf"))
|
||||||
|
_StatRTB.Rtf = str.Replace(@"\~", @"\u160?");
|
||||||
|
else
|
||||||
|
_StatRTB.Text = str;
|
||||||
|
_StatRTB.SelectAll();
|
||||||
|
_StatRTB.SelectionColor = PrintOverride.OverrideTextColor(System.Drawing.Color.Black);
|
||||||
|
str = _StatRTB.Rtf;
|
||||||
|
return str;
|
||||||
|
}
|
||||||
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf)
|
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf)
|
||||||
{
|
{
|
||||||
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
|
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
|
||||||
@ -590,15 +610,38 @@ namespace Volian.Print.Library
|
|||||||
myColumnText.Canvas.RestoreState();
|
myColumnText.Canvas.RestoreState();
|
||||||
}
|
}
|
||||||
private static float _SixLinesPerInch = 12; // twips
|
private static float _SixLinesPerInch = 12; // twips
|
||||||
|
public bool IsRangeStyleNull = false;
|
||||||
|
private TextAlignEnum? _TextAlign = null;
|
||||||
|
public TextAlignEnum? TextAlign
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_TextAlign == null)
|
||||||
|
{
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
||||||
|
if (cr.Style == null)
|
||||||
|
{
|
||||||
|
IsRangeStyleNull = true;
|
||||||
|
return _TextAlign;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsRangeStyleNull = false;
|
||||||
|
_TextAlign = cr.Style.TextAlign;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (TextAlignEnum)_TextAlign;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Private Text Methods
|
#region Private Text Methods
|
||||||
private float VeritcalTextAlignment(float h)
|
private float VeritcalTextAlignment(float h)
|
||||||
{
|
{
|
||||||
float hAdjust = 0;
|
float hAdjust = 0;
|
||||||
CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
//CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
||||||
if (cr.Style != null)
|
if (!IsRangeStyleNull)
|
||||||
{
|
{
|
||||||
switch (cr.Style.TextAlign)
|
switch (TextAlign)
|
||||||
{
|
{
|
||||||
case TextAlignEnum.CenterBottom:
|
case TextAlignEnum.CenterBottom:
|
||||||
case TextAlignEnum.GeneralBottom:
|
case TextAlignEnum.GeneralBottom:
|
||||||
|
@ -1679,9 +1679,9 @@ namespace Volian.Print.Library
|
|||||||
bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff;
|
bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff;
|
||||||
if (itemInfo.MyContent.MyGrid != null)
|
if (itemInfo.MyContent.MyGrid != null)
|
||||||
{
|
{
|
||||||
VlnFlexGrid myFlexGrid = new VlnFlexGrid(1, 1);
|
//VlnFlexGrid myFlexGrid = new VlnFlexGrid(1, 1);
|
||||||
myFlexGrid.LoadGrid(itemInfo);
|
MyFlexGrid.LoadGrid(itemInfo);
|
||||||
MyGrid = new vlnTable(myFlexGrid, cb);
|
MyGrid = new vlnTable(MyFlexGrid, cb);
|
||||||
Height = MyGrid.Height;
|
Height = MyGrid.Height;
|
||||||
Width = MyGrid.Width;
|
Width = MyGrid.Width;
|
||||||
|
|
||||||
@ -1700,7 +1700,7 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
// if the table does not have a border, only move down one line:
|
// if the table does not have a border, only move down one line:
|
||||||
float yoffForBorder = 2 * SixLinesPerInch;
|
float yoffForBorder = 2 * SixLinesPerInch;
|
||||||
if (myFlexGrid.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !myFlexGrid.TopRowHasBorder())
|
if (MyFlexGrid.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !MyFlexGrid.TopRowHasBorder())
|
||||||
yoffForBorder -= SixLinesPerInch;
|
yoffForBorder -= SixLinesPerInch;
|
||||||
|
|
||||||
//yForCheckoff = yoff + Height - SixLinesPerInch;
|
//yForCheckoff = yoff + Height - SixLinesPerInch;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user