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

@@ -315,6 +315,28 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_PreferredPagebreak");
}
}
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
// EmptyStep was added to make printing consistent after saving of trailing newlines/spaces.
// The print code was printing an empty string rather than a space. But a space gets saved since
// without it the step is deleted.
public bool Step_EmptyStep
{
get
{
string s = _Xp["Step", "EmptyStep"];
if (s == string.Empty) return false;
if (s == "True") return true;
return false;
}
set
{
string s = _Xp["Step", "EmptyStep"];
if (value.ToString() == s) return;
_Xp["Step", "EmptyStep"] = value.ToString();
OnPropertyChanged("Step_EmptyStep");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Change Bar Override")]
//[RefreshProperties(RefreshProperties.All)]

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)