Made some regx usages static to help with memory usage
Logic to support clipboard paste of screen shot into a table cell
This commit is contained in:
parent
ba3bceadae
commit
df37f61cb5
@ -1184,6 +1184,16 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
return "";//Strip All
|
return "";//Strip All
|
||||||
}
|
}
|
||||||
|
private static Regex reg1 = new Regex(@"\\par\r\n(?!\\)");
|
||||||
|
private static Regex reg2 = new Regex(@"[\r\n]", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
||||||
|
private static Regex reg3 = new Regex(@"^\{(.*)\}$", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
||||||
|
private static Regex reg4 = new Regex(@"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
private static Regex reg5 = new Regex( @"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
private static Regex reg6 = new Regex(@"(\\[^' \\?\r\n\t]+)(?=\\)"); // add space after token if followed by token
|
||||||
|
private static Regex reg7 = new Regex(@"(\\[^' \\?\r\n\t]+ )"); // take backslash xyz and evaluates them
|
||||||
|
private static Regex reg8 = new Regex( @"(\\[^' \\?\r\n\t]+) (?=\\)"); // remove space between tokens
|
||||||
|
private static Regex reg9 = new Regex( @"(\\[^' \\?\r\n\t]+) (?=\r\n)"); // remove space before /r/n
|
||||||
|
|
||||||
public string StripRtfCommands(string rtf)
|
public string StripRtfCommands(string rtf)
|
||||||
{
|
{
|
||||||
// replace \{ & \} with (![ & (!] respectively and then redo at end. The curly braces
|
// replace \{ & \} with (![ & (!] respectively and then redo at end. The curly braces
|
||||||
@ -1193,16 +1203,28 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
// remove carriage return/newlines after \par commands (these are introduced by rtb
|
// remove carriage return/newlines after \par commands (these are introduced by rtb
|
||||||
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
||||||
retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par ");
|
retval = reg1.Replace(retval, "\\par ");
|
||||||
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
|
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
|
||||||
retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
retval = reg2.Replace(retval, ""); // Strip Carriage Returns and Newlines
|
||||||
retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
retval = reg3.Replace(retval, "$1"); // Strip Opening and Closing Braces
|
||||||
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
retval = reg4.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
|
||||||
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
retval = reg5.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
|
||||||
retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+)(?=\\)", "$1 "); // add space after token if followed by token
|
retval = reg6.Replace(retval, "$1 "); // add space after token if followed by token
|
||||||
retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+ )", new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
|
retval = reg7.Replace(retval, new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
|
||||||
retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+) (?=\\)", "$1"); // remove space between tokens
|
retval = reg8.Replace(retval, "$1"); // remove space between tokens
|
||||||
retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+) (?=\r\n)", "$1"); // remove space before /r/n
|
retval = reg9.Replace(retval, "$1"); // remove space before /r/n
|
||||||
|
|
||||||
|
//retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par ");
|
||||||
|
//retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
|
||||||
|
//retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
||||||
|
//retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
||||||
|
//retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
//retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+)(?=\\)", "$1 "); // add space after token if followed by token
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+ )", new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+) (?=\\)", "$1"); // remove space between tokens
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+) (?=\r\n)", "$1"); // remove space before /r/n
|
||||||
|
|
||||||
// remove \r\n at end of string if the string has 2 or more characters
|
// remove \r\n at end of string if the string has 2 or more characters
|
||||||
if (retval.EndsWith("\r\n")) retval = retval.Remove(retval.Length - 2, 2);
|
if (retval.EndsWith("\r\n")) retval = retval.Remove(retval.Length - 2, 2);
|
||||||
if (retval.Length == 0) return "";
|
if (retval.Length == 0) return "";
|
||||||
@ -1213,6 +1235,18 @@ namespace Volian.Controls.Library
|
|||||||
retval = retval.TrimEnd(' ');
|
retval = retval.TrimEnd(' ');
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Regex sreg1 = new Regex(@"\\par\r\n(?!\\)");
|
||||||
|
private static Regex sreg2 = new Regex(@"[\r\n]",RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
||||||
|
private static Regex sreg3 = new Regex(@"^\{(.*)\}$", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
||||||
|
private static Regex sreg4 = new Regex(@"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
private static Regex sreg5 = new Regex(@"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
private static Regex sreg6 = new Regex(@"(\\[^' \\?\r\n\t]+)(?=\\)"); // add space after token if followed by token
|
||||||
|
private static Regex sreg7 = new Regex(@"(\\[^ \\?\r\n\t]+ )"); // take backslash xyz and evaluates them
|
||||||
|
private static Regex sreg8 = new Regex(@"(\\[^ \\?\r\n\t]+) (?=\\)"); // remove space between tokens
|
||||||
|
private static Regex sreg9 = new Regex(@"(\\[^ \\?\r\n\t]+) (?=\r\n)"); // remove space before /r/n
|
||||||
|
|
||||||
|
|
||||||
// This is used in the DataLoader
|
// This is used in the DataLoader
|
||||||
public static string StaticStripRtfCommands(string rtf)
|
public static string StaticStripRtfCommands(string rtf)
|
||||||
{
|
{
|
||||||
@ -1231,26 +1265,39 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
// remove carriage return/newlines after \par commands (these are introduced by rtb
|
// remove carriage return/newlines after \par commands (these are introduced by rtb
|
||||||
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
||||||
retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par ");
|
retval = sreg1.Replace(retval, "\\par ");
|
||||||
//retval = Regex.Replace(retval, @"\\par\r\n(?=\\)", "\\par");
|
|
||||||
|
|
||||||
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
|
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
|
||||||
retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
retval = sreg2.Replace(retval,""); // Strip Carriage Returns and Newlines
|
||||||
retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
retval = sreg3.Replace(retval, "$1"); // Strip Opening and Closing Braces
|
||||||
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
retval = sreg4.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
|
||||||
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
retval = sreg5.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
|
||||||
//retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+)\\f[0-9] ", "$1 "); // remove font command - if next to another command, keep other command and space
|
retval = sreg6.Replace(retval,"$1 "); // add space after token if followed by token
|
||||||
// OLD: The following two lines are replaced by the more generic replace above.
|
retval = sreg7.Replace(retval, new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
|
||||||
//retval = Regex.Replace(retval, @"\\v\\f[0-9] ", "\\v "); // remove font command - if next to Comment keep space
|
retval = sreg8.Replace(retval, "$1"); // remove space between tokens
|
||||||
//retval = Regex.Replace(retval, @"\\line\\f[0-9] ", "\\line "); // remove font command - if next to Line keep space
|
retval = sreg9.Replace(retval, "$1"); // remove space before /r/n
|
||||||
//retval = Regex.Replace(retval, @"\\f[0-9] ", ""); // remove font command with ending space
|
|
||||||
//retval = Regex.Replace(retval, @"\\f[0-9]", ""); // remove font command without ending space
|
//retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par ");
|
||||||
//retval = Regex.Replace(retval, @"\\par ", "\r\n");
|
////retval = Regex.Replace(retval, @"\\par\r\n(?=\\)", "\\par");
|
||||||
retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+)(?=\\)", "$1 "); // add space after token if followed by token
|
|
||||||
//retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+)(\\)", "$1 $2"); // take backslash xyz and evaluates them
|
//retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
|
||||||
retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+ )", new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
|
//retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
||||||
retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+) (?=\\)", "$1"); // remove space between tokens
|
//retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
||||||
retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+) (?=\r\n)", "$1"); // remove space before /r/n
|
//retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
//retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
////retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+)\\f[0-9] ", "$1 "); // remove font command - if next to another command, keep other command and space
|
||||||
|
//// OLD: The following two lines are replaced by the more generic replace above.
|
||||||
|
////retval = Regex.Replace(retval, @"\\v\\f[0-9] ", "\\v "); // remove font command - if next to Comment keep space
|
||||||
|
////retval = Regex.Replace(retval, @"\\line\\f[0-9] ", "\\line "); // remove font command - if next to Line keep space
|
||||||
|
////retval = Regex.Replace(retval, @"\\f[0-9] ", ""); // remove font command with ending space
|
||||||
|
////retval = Regex.Replace(retval, @"\\f[0-9]", ""); // remove font command without ending space
|
||||||
|
////retval = Regex.Replace(retval, @"\\par ", "\r\n");
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+)(?=\\)", "$1 "); // add space after token if followed by token
|
||||||
|
////retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+)(\\)", "$1 $2"); // take backslash xyz and evaluates them
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+ )", new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+) (?=\\)", "$1"); // remove space between tokens
|
||||||
|
//retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+) (?=\r\n)", "$1"); // remove space before /r/n
|
||||||
|
|
||||||
// remove a space if there is one as the first character or the last character
|
// remove a space if there is one as the first character or the last character
|
||||||
//if (retval[0] == ' ') retval = retval.Remove(0, 1);
|
//if (retval[0] == ' ') retval = retval.Remove(0, 1);
|
||||||
//retval = retval.TrimEnd(' ');
|
//retval = retval.TrimEnd(' ');
|
||||||
|
@ -806,7 +806,7 @@ namespace Volian.Controls.Library
|
|||||||
private bool _ContextMenuStripChanged = false;
|
private bool _ContextMenuStripChanged = false;
|
||||||
private void StepRTB_MouseDown(object sender, MouseEventArgs e)
|
private void StepRTB_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
_MouseDown = true;
|
|
||||||
//Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID);
|
//Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID);
|
||||||
bool inPsi = this.Parent.FindForm().Name.Contains("frmPSI");
|
bool inPsi = this.Parent.FindForm().Name.Contains("frmPSI");
|
||||||
if (!_ContextMenuStripChanged)
|
if (!_ContextMenuStripChanged)
|
||||||
@ -1932,6 +1932,12 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
private bool IsControlChar = false;
|
private bool IsControlChar = false;
|
||||||
private bool _SendBackSpace = false;
|
private bool _SendBackSpace = false;
|
||||||
|
private int _ImageWidth = 0;
|
||||||
|
public int ImageWidth
|
||||||
|
{
|
||||||
|
get { return _ImageWidth; }
|
||||||
|
set { _ImageWidth = value; }
|
||||||
|
}
|
||||||
void StepRTB_KeyDown(object sender, KeyEventArgs e)
|
void StepRTB_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
// added jcb 20130103 to support set ro from word doc with annotation when right click menu is opened by keyboard
|
// added jcb 20130103 to support set ro from word doc with annotation when right click menu is opened by keyboard
|
||||||
@ -1980,15 +1986,25 @@ namespace Volian.Controls.Library
|
|||||||
// maps the Ctrl-V to btnPaste for those StepRTB's that are associated with the StepTabRibbon, i.e.
|
// maps the Ctrl-V to btnPaste for those StepRTB's that are associated with the StepTabRibbon, i.e.
|
||||||
// EditItems & Grid cells.
|
// EditItems & Grid cells.
|
||||||
IDataObject iData = Clipboard.GetDataObject();
|
IDataObject iData = Clipboard.GetDataObject();
|
||||||
if (!iData.GetDataPresent(DataFormats.Text) && !iData.GetDataPresent(DataFormats.Rtf))
|
if (iData.GetDataPresent(DataFormats.Dib)) // Device Independent Bitmap
|
||||||
{
|
{
|
||||||
MessageBox.Show("Cannot paste, text has special characters or symbols that will not paste correctly.");
|
System.Drawing.Image img = Clipboard.GetImage();
|
||||||
|
ImageWidth = img.Width;
|
||||||
|
Width = ImageWidth + 2;
|
||||||
|
Paste();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if contains bad rtf (from Word), paste as text, otherwise, do the paste here.
|
if (!iData.GetDataPresent(DataFormats.Text) && !iData.GetDataPresent(DataFormats.Rtf))
|
||||||
if (!PasteRtfAsText(true)) Paste();
|
{
|
||||||
if (SelectionLength == 0) SelectionFont = MyStyleFont.WindowsFont;
|
MessageBox.Show("Cannot paste, text has special characters or symbols that will not paste correctly.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if contains bad rtf (from Word), paste as text, otherwise, do the paste here.
|
||||||
|
if (!PasteRtfAsText(true)) Paste();
|
||||||
|
if (SelectionLength == 0) SelectionFont = MyStyleFont.WindowsFont;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
|
@ -927,13 +927,20 @@ namespace Volian.Controls.Library
|
|||||||
// monitor is different than the DPI setting saved in the grid record, table height/width of rows/columns
|
// monitor is different than the DPI setting saved in the grid record, table height/width of rows/columns
|
||||||
// will be incorrect, i.e. lots of extra white space. The reason behind this is that the height/width
|
// will be incorrect, i.e. lots of extra white space. The reason behind this is that the height/width
|
||||||
// of table cells are stored as dots (from the monitor) in the underlying component one flexgrid.
|
// of table cells are stored as dots (from the monitor) in the underlying component one flexgrid.
|
||||||
str = AdjustHeightAndWidthForDPI(str);
|
try
|
||||||
using (StringReader sr = new StringReader(str))
|
{
|
||||||
{
|
str = AdjustHeightAndWidthForDPI(str);
|
||||||
ReadXml(sr);
|
using (StringReader sr = new StringReader(str))
|
||||||
this.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None;
|
{
|
||||||
sr.Close();
|
ReadXml(sr);
|
||||||
}
|
this.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None;
|
||||||
|
sr.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string AdjustHeightAndWidthForDPI(string str)
|
private string AdjustHeightAndWidthForDPI(string str)
|
||||||
@ -1087,6 +1094,7 @@ namespace Volian.Controls.Library
|
|||||||
CellRange cr = GetMergedRange(Row, Col);
|
CellRange cr = GetMergedRange(Row, Col);
|
||||||
int oH = cr.UserData == null ? curHeight : (int)cr.UserData;
|
int oH = cr.UserData == null ? curHeight : (int)cr.UserData;
|
||||||
int nH = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
int nH = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||||
|
int nW = _tableCellEditor.Width; // Width
|
||||||
int Hadj = (nH - curHeight);//oH);
|
int Hadj = (nH - curHeight);//oH);
|
||||||
cr.UserData = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
cr.UserData = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||||
//int cellHeight = GetCellHeight(Row, Col);
|
//int cellHeight = GetCellHeight(Row, Col);
|
||||||
@ -1112,6 +1120,10 @@ namespace Volian.Controls.Library
|
|||||||
AdjustGridControlSize();
|
AdjustGridControlSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_tableCellEditor is StepRTB && (_tableCellEditor as StepRTB).ImageWidth > 0)
|
||||||
|
{
|
||||||
|
Width = Cols[0].Width = (_tableCellEditor as StepRTB).ImageWidth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void VlnFlexGrid_KeyUp(object sender, KeyEventArgs e)
|
void VlnFlexGrid_KeyUp(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -512,12 +512,13 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
private void TrimNewlines(Paragraph myPara)
|
private void TrimNewlines(Paragraph myPara)
|
||||||
{
|
{
|
||||||
while (myPara.Chunks.Count > 0 && ParaEndsWithNewLine(myPara))
|
while (myPara.Count > 0 && ParaEndsWithNewLine(myPara))
|
||||||
myPara.RemoveAt(myPara.Chunks.Count - 1);
|
myPara.RemoveAt(myPara.Count - 1);
|
||||||
}
|
}
|
||||||
private bool ParaEndsWithNewLine(Paragraph myPara)
|
private bool ParaEndsWithNewLine(Paragraph myPara)
|
||||||
{
|
{
|
||||||
Chunk chk = myPara.Chunks[myPara.Chunks.Count - 1] as Chunk;
|
Chunk chk = myPara[myPara.Count - 1] as Chunk;
|
||||||
|
if (chk == null) return false;
|
||||||
if (chk.Content == "\n") return true;
|
if (chk.Content == "\n") return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1056,6 +1057,17 @@ namespace Volian.Print.Library
|
|||||||
MyPara.MultipliedLeading *= _MyPageHelper.YMultiplier;
|
MyPara.MultipliedLeading *= _MyPageHelper.YMultiplier;
|
||||||
vlnCells.FixHyphens(MyPara, MyTable);
|
vlnCells.FixHyphens(MyPara, MyTable);
|
||||||
myColumnText1.AddElement(MyPara);
|
myColumnText1.AddElement(MyPara);
|
||||||
|
foreach(object obj in MyPara)
|
||||||
|
{
|
||||||
|
if(obj is iTextSharp.text.Image)
|
||||||
|
{
|
||||||
|
iTextSharp.text.Image img = obj as iTextSharp.text.Image;
|
||||||
|
img.SetAbsolutePosition(left,top-h);
|
||||||
|
img.ScaleAbsoluteWidth(w);
|
||||||
|
img.ScaleAbsoluteHeight(h);
|
||||||
|
myColumnText.Canvas.AddImage(img);
|
||||||
|
}
|
||||||
|
}
|
||||||
float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch
|
float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch
|
||||||
myColumnText1.Go();
|
myColumnText1.Go();
|
||||||
float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch
|
float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch
|
||||||
|
@ -152,7 +152,7 @@ namespace Volian.Print.Library
|
|||||||
switch (visualBreak.BreakKind)
|
switch (visualBreak.BreakKind)
|
||||||
{
|
{
|
||||||
case RtfVisualBreakKind.Line:
|
case RtfVisualBreakKind.Line:
|
||||||
Chunk ck = new Chunk("".PadLeft(200));
|
Chunk ck = HasIndent ? new Chunk("".PadLeft(200)) : new Chunk("".PadLeft(200));
|
||||||
_MyParagraph.Add(ck);
|
_MyParagraph.Add(ck);
|
||||||
break;
|
break;
|
||||||
case RtfVisualBreakKind.Page:
|
case RtfVisualBreakKind.Page:
|
||||||
@ -392,21 +392,23 @@ namespace Volian.Print.Library
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
protected override void DoVisitImage(IRtfVisualImage visualImage)
|
protected override void DoVisitImage(IRtfVisualImage visualImage)
|
||||||
{
|
{
|
||||||
_MyParagraph.Add(new Chunk("<Image>"));
|
//_MyParagraph.Add(new Chunk("<Image>"));
|
||||||
//WriteStartElement("rtfVisualImage");
|
DateTime dt1 = DateTime.Now;
|
||||||
|
//System.Drawing.Image img2 = visualImage.ImageForDrawing;
|
||||||
|
//Console.WriteLine("1 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||||
|
//img2.Save(@"c:\datacvrt\x.png");
|
||||||
|
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||||
|
|
||||||
//WriteElementString("format", visualImage.Format.ToString());
|
//Console.WriteLine("2 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||||
//WriteElementString("width", visualImage.Width.ToString());
|
Console.WriteLine("Size {0}", visualImage.ImageForDrawing.Size);
|
||||||
//WriteElementString("height", visualImage.Height.ToString());
|
visualImage.ImageForDrawing.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||||
//WriteElementString("desiredWidth", visualImage.DesiredWidth.ToString());
|
//Console.WriteLine("3 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||||
//WriteElementString("desiredHeight", visualImage.DesiredHeight.ToString());
|
ms.Seek(0, System.IO.SeekOrigin.Begin);
|
||||||
//WriteElementString("scaleWidthPercent", visualImage.ScaleWidthPercent.ToString());
|
//Console.WriteLine("4 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||||
//WriteElementString("scaleHeightPercent", visualImage.ScaleHeightPercent.ToString());
|
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ms);
|
||||||
//WriteElementString("alignment", visualImage.Alignment.ToString());
|
//Console.WriteLine("5 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||||
|
_MyParagraph.Add(img);
|
||||||
//WriteElementString("image", visualImage.ImageDataHex.ToString());
|
Console.WriteLine("6 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||||
|
|
||||||
//WriteEndElement();
|
|
||||||
} // DoVisitImage
|
} // DoVisitImage
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user