C2021-010: Print using standard pagination rules by removing trailing hard returns, spaces & manual page breaks

This commit is contained in:
2021-02-23 14:51:49 +00:00
parent 6499c9a23c
commit b679829508
11 changed files with 421 additions and 207 deletions

View File

@@ -15,6 +15,7 @@ namespace VEPROMS.CSLA.Library
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Properties
public static int RemoveTrailingBlankID = -1;
private bool _setDTS = true; // Added for when data is cleaned so that DTS/UserID are not reset (for B2016-037 fix)
public bool SetDTS
{
@@ -132,6 +133,24 @@ namespace VEPROMS.CSLA.Library
_MyItemInfo = itemInfo;
OriginalText = epMode == E_EditPrintMode.Print && RemoveTrailingHardReturnAndManualPageBreaks ?
Regex.Replace(InfoText, "(\\\\line|\r|\n|\\\\u160\\?| )+$", "") : InfoText;
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. Use RemoveTrailingBlankID to
// return the itemid if this item's text was changed because print is occurring with removal of trailing
// hardreturns.
RemoveTrailingBlankID = -1;
if (!itemInfo.IsTable && RemoveTrailingHardReturnAndManualPageBreaks && InfoText != OriginalText)
{
// No 'true' change occurred if trailing space was after an rtf command
if (!OriginalText.EndsWith(@"\b0") && !OriginalText.EndsWith(@"\i0") && !OriginalText.EndsWith(@"\ulnone") &&
!OriginalText.EndsWith(@"\up0") && !OriginalText.EndsWith(@"\dn0"))
RemoveTrailingBlankID = itemInfo.ItemID;
else
OriginalText = InfoText;
}
if (epMode == E_EditPrintMode.Print && !RemoveTrailingHardReturnAndManualPageBreaks) // if step was made empty from previous print & not removing now, text is an empty string
{
StepConfig sc = itemInfo.MyConfig as StepConfig;
if (sc != null && sc.Step_EmptyStep) OriginalText = "";
}
//OriginalText = InfoText;
//if (OriginalText != InfoText) Console.WriteLine("ItemId = {0}, {1}", itemInfo.ItemID, OriginalText.Length-InfoText.Length);
if (OriginalText.Contains("Prerequisite") && epMode == E_EditPrintMode.Print)