B2021-028: During print, removal of trailing spaces and newlines causes missing line in print of empty steps
This commit is contained in:
@@ -2479,8 +2479,8 @@ namespace Volian.Print.Library
|
||||
{
|
||||
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);
|
||||
sc.Step_NewManualPagebreak = false; // reset the flag that was set in the config
|
||||
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
|
||||
itm.MyContent.Config = sc.ToString();
|
||||
itm.MyContent.DTS = DateTime.Now;
|
||||
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||
@@ -2501,42 +2501,41 @@ namespace Volian.Print.Library
|
||||
string annot = "Removed Trailing Newlines and Spaces";
|
||||
if (RemoveManualPageBreaks != null && RemoveManualPageBreaks.Contains(iid)) annot = "Removed Trailing Newlines, Spaces and ManualPageBreak";
|
||||
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
|
||||
// that this is an emtpy step so that print can handle it, i.e. when text is set for step during printing,
|
||||
// if it is emtpy the string is "", which prints without height. This is flagged so that the pdf will
|
||||
// look the same, i.e. printed when trailing newlines/spaces are removed (text = "") & after the changes
|
||||
// are saved (text = " ")
|
||||
// if the step ends up empty, set the text to a space (if null or "") step gets deleted.
|
||||
// B2021-028: removed code that set a step config item flagging an empty step. This had been put in to print
|
||||
// the same way before save but that printing was wrong and was fixed for this bug.
|
||||
if (tmp == null || tmp == "")
|
||||
{
|
||||
StepConfig sctmp = iitmp.MyConfig as StepConfig;
|
||||
if (sctmp == null) sctmp = new StepConfig();
|
||||
sctmp.Step_EmptyStep = true;
|
||||
tmp = " ";
|
||||
annot = "Empty step. Consider deleting to restore standard pagination.";
|
||||
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.Config = sctmp.ToString();
|
||||
itm.MyContent.Text = " ";
|
||||
itm.MyContent.DTS = DateTime.Now;
|
||||
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||
itm.MyContent.Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
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);
|
||||
itm.MyContent.Text = tmp;
|
||||
itm.MyContent.DTS = DateTime.Now;
|
||||
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||
itm.MyContent.Save();
|
||||
}
|
||||
if (!alreadyHasAnnot) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, annot, null);
|
||||
itm.MyContent.Text = tmp;
|
||||
itm.MyContent.DTS = DateTime.Now;
|
||||
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||
itm.MyContent.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
Reference in New Issue
Block a user