B2021-028: During print, removal of trailing spaces and newlines causes missing line in print of empty steps
This commit is contained in:
parent
bbf3bcd0b1
commit
acb9bc903e
@ -315,28 +315,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
OnPropertyChanged("Step_PreferredPagebreak");
|
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")]
|
//[Category("Step Attributes")]
|
||||||
//[DisplayName("Step Change Bar Override")]
|
//[DisplayName("Step Change Bar Override")]
|
||||||
//[RefreshProperties(RefreshProperties.All)]
|
//[RefreshProperties(RefreshProperties.All)]
|
||||||
|
@ -142,15 +142,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// No 'true' change occurred if trailing space was after an rtf command
|
// No 'true' change occurred if trailing space was after an rtf command
|
||||||
if (!OriginalText.EndsWith(@"\b0") && !OriginalText.EndsWith(@"\i0") && !OriginalText.EndsWith(@"\ulnone") &&
|
if (!OriginalText.EndsWith(@"\b0") && !OriginalText.EndsWith(@"\i0") && !OriginalText.EndsWith(@"\ulnone") &&
|
||||||
!OriginalText.EndsWith(@"\up0") && !OriginalText.EndsWith(@"\dn0"))
|
!OriginalText.EndsWith(@"\up0") && !OriginalText.EndsWith(@"\dn0"))
|
||||||
|
{
|
||||||
RemoveTrailingBlankID = itemInfo.ItemID;
|
RemoveTrailingBlankID = itemInfo.ItemID;
|
||||||
|
if (OriginalText == "") OriginalText = " "; // B2021-028: don't make step empty, print with a space
|
||||||
|
}
|
||||||
else
|
else
|
||||||
OriginalText = InfoText;
|
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;
|
//OriginalText = InfoText;
|
||||||
//if (OriginalText != InfoText) Console.WriteLine("ItemId = {0}, {1}", itemInfo.ItemID, OriginalText.Length-InfoText.Length);
|
//if (OriginalText != InfoText) Console.WriteLine("ItemId = {0}, {1}", itemInfo.ItemID, OriginalText.Length-InfoText.Length);
|
||||||
if (OriginalText.Contains("Prerequisite") && epMode == E_EditPrintMode.Print)
|
if (OriginalText.Contains("Prerequisite") && epMode == E_EditPrintMode.Print)
|
||||||
|
@ -2479,7 +2479,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
using (Item itm = Item.Get(iid))
|
using (Item itm = Item.Get(iid))
|
||||||
{
|
{
|
||||||
VEPROMS.CSLA.Library.Annotation x = VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, "Removed Manual Page Break", null);
|
if (!HasManPagAnnot(ii, "Removed Manual Page Break")) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, "Removed Manual Page Break", null);
|
||||||
sc.Step_NewManualPagebreak = false; // reset the flag that was set in the config
|
sc.Step_NewManualPagebreak = false; // reset the flag that was set in the config
|
||||||
itm.MyContent.Config = sc.ToString();
|
itm.MyContent.Config = sc.ToString();
|
||||||
itm.MyContent.DTS = DateTime.Now;
|
itm.MyContent.DTS = DateTime.Now;
|
||||||
@ -2501,32 +2501,18 @@ namespace Volian.Print.Library
|
|||||||
string annot = "Removed Trailing Newlines and Spaces";
|
string annot = "Removed Trailing Newlines and Spaces";
|
||||||
if (RemoveManualPageBreaks != null && RemoveManualPageBreaks.Contains(iid)) annot = "Removed Trailing Newlines, Spaces and ManualPageBreak";
|
if (RemoveManualPageBreaks != null && RemoveManualPageBreaks.Contains(iid)) annot = "Removed Trailing Newlines, Spaces and ManualPageBreak";
|
||||||
string tmp = Regex.Replace(iitmp.MyContent.Text, "(\\\\line|\r|\n|\\\\u160\\?| )+$", "");
|
string tmp = Regex.Replace(iitmp.MyContent.Text, "(\\\\line|\r|\n|\\\\u160\\?| )+$", "");
|
||||||
// if the step ends up empty, set the text to a space (if null or "") step gets deleted. Also, flag
|
// if the step ends up empty, set the text to a space (if null or "") step gets deleted.
|
||||||
// that this is an emtpy step so that print can handle it, i.e. when text is set for step during printing,
|
// B2021-028: removed code that set a step config item flagging an empty step. This had been put in to print
|
||||||
// if it is emtpy the string is "", which prints without height. This is flagged so that the pdf will
|
// the same way before save but that printing was wrong and was fixed for this bug.
|
||||||
// look the same, i.e. printed when trailing newlines/spaces are removed (text = "") & after the changes
|
|
||||||
// are saved (text = " ")
|
|
||||||
if (tmp == null || tmp == "")
|
if (tmp == null || tmp == "")
|
||||||
{
|
{
|
||||||
StepConfig sctmp = iitmp.MyConfig as StepConfig;
|
tmp = " ";
|
||||||
if (sctmp == null) sctmp = new StepConfig();
|
|
||||||
sctmp.Step_EmptyStep = true;
|
|
||||||
annot = "Empty step. Consider deleting to restore standard pagination.";
|
annot = "Empty step. Consider deleting to restore standard pagination.";
|
||||||
|
}
|
||||||
|
bool alreadyHasAnnot = HasManPagAnnot(iitmp, annot); // don't add annotation if it exists.
|
||||||
using (Item itm = Item.Get(iid))
|
using (Item itm = Item.Get(iid))
|
||||||
{
|
{
|
||||||
VEPROMS.CSLA.Library.Annotation x = VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, annot, null);
|
if (!alreadyHasAnnot) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, annot, null);
|
||||||
itm.MyContent.Config = sctmp.ToString();
|
|
||||||
itm.MyContent.Text = " ";
|
|
||||||
itm.MyContent.DTS = DateTime.Now;
|
|
||||||
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
|
|
||||||
itm.MyContent.Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
using (Item itm = Item.Get(iid))
|
|
||||||
{
|
|
||||||
VEPROMS.CSLA.Library.Annotation x = VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, annot, null);
|
|
||||||
itm.MyContent.Text = tmp;
|
itm.MyContent.Text = tmp;
|
||||||
itm.MyContent.DTS = DateTime.Now;
|
itm.MyContent.DTS = DateTime.Now;
|
||||||
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
|
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||||
@ -2536,6 +2522,19 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HasManPagAnnot(ItemInfo iitmp, string annotstr)
|
||||||
|
{
|
||||||
|
if (iitmp.ItemAnnotations != null && iitmp.ItemAnnotationCount > 0)
|
||||||
|
{
|
||||||
|
// check each annotation to see if this manual pagination issue exists - so it won't get added again.
|
||||||
|
foreach (AnnotationInfo ai in iitmp.ItemAnnotations)
|
||||||
|
{
|
||||||
|
if (ai.MyAnnotationType.Name.StartsWith("Manual Pagination Issues"))
|
||||||
|
if (ai.SearchText.StartsWith(annotstr)) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class ReaderHelper
|
public class ReaderHelper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user