using System; using System.Collections.Generic; using System.Text; using iTextSharp.text; using iTextSharp.text.pdf; using iTextSharp.text.factories; using Volian.Svg.Library; using System.Text.RegularExpressions; using System.Xml; using VEPROMS.CSLA.Library; namespace Volian.Print.Library { public class VlnSvgPageHelper:SvgPageHelper { // This handles Page Breaks within a Step private List _ParaBreaks = new List(); public List ParaBreaks { get { return _ParaBreaks; } set { _ParaBreaks = value; } } private VlnDestinations _VlnDestinations = new VlnDestinations(); public VlnDestinations VlnDestinations { get { return _VlnDestinations; } set { _VlnDestinations = value; } } private PdfOutline _MyPdfOutline = null; public PdfOutline MyPdfOutline { get { return _MyPdfOutline; } set { _MyPdfOutline = value; } } private vlnText _TopMessage; public vlnText TopMessage { get { return _TopMessage; } set { _TopMessage = value; } } private vlnText _BottomMessage; public vlnText BottomMessage { get { return _BottomMessage; } set { _BottomMessage = value; } } Dictionary _MyParagraphs = new Dictionary(); public Dictionary MyParagraphs { get { return _MyParagraphs; } set { _MyParagraphs = value; } } float _YMultiplier = 1; public float YMultiplier { get { return _YMultiplier; } set { _YMultiplier = value; } } private PdfWriter _MyPdfWriter; public PdfWriter MyPdfWriter { get { return _MyPdfWriter; } set { MyPageCounts = new PageCounts(); _MyPdfWriter = value; } } private PdfContentByte _MyPdfContentByte; public PdfContentByte MyPdfContentByte { get { return _MyPdfContentByte; } set { _MyPdfContentByte = value; } } public override void OnCloseDocument(PdfWriter writer, iTextSharp.text.Document document) { AddBookmarks(writer); MyPageCounts.DrawTemplates(); } public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document) { AddBookmarks(writer); MyPageCounts.CanIncrement = true; base.OnEndPage(writer, document); DrawChangeBars(writer.DirectContent); DrawMessages(writer.DirectContent); DrawRuler(writer.DirectContent); } private void DrawRuler(PdfContentByte cb) { if (DebugLayer == null) return; cb.SaveState(); cb.BeginLayer(DebugLayer); float x = (cb.PdfWriter.PageSize.Left + cb.PdfWriter.PageSize.Right) / 2; cb.SetLineWidth(.1F); cb.SetColorStroke(new Color(System.Drawing.Color.CornflowerBlue)); float yTop = 648; float yBottom = 48; cb.MoveTo(x, yTop); cb.LineTo(x, yBottom); int i = 0; for (float y = yTop; y >= yBottom; y -= 12) { float w = 10; if (i % 10 == 0) w = 30; else if (i % 5 == 0) w = 20; i++; cb.MoveTo(x - w, y); cb.LineTo(x, y); } i = 0; for (float y = yTop; y >= yBottom; y -= 10.1F) { float w = 10; if (i % 10 == 0) w = 30; else if (i % 5 == 0) w = 20; i++; cb.MoveTo(x + w, y-1); cb.LineTo(x, y-1); } cb.Stroke(); cb.EndLayer(); cb.RestoreState(); } private void AddBookmarks(PdfWriter writer) { if (MySectionTitle != null) { PdfDestination dest = new PdfDestination(PdfDestination.FIT); MyPdfOutline = new PdfOutline(writer.DirectContent.RootOutline, dest, MySectionTitle, false); MySectionTitle = null; } if (VlnDestinations.Count > 0 && MyPdfOutline != null) { foreach (VlnDestination vd in VlnDestinations) { new PdfOutline(MyPdfOutline, vd.PdfDestination, vd.Title, false); } VlnDestinations.Clear(); } } private void DrawMessages(PdfContentByte cb) { if (TopMessage != null) { TopMessage.ToPdf(cb, 0, 0, 0); TopMessage = null; // Only output it once. } if (BottomMessage != null) { BottomMessage.ToPdf(cb, 0, 0, 0); BottomMessage = null; // Only output it once. } } private void DrawChangeBars(PdfContentByte cb) { foreach (vlnChangeBar vcb in MyChangeBars) { // TODO: Pass in zeroes because topdf is inherited. vcb.ToPdf(cb, 0, 0, 0); } _MyChangeBars = new List(); } #region SectionLevelData private ChangeBarDefinition _ChangeBarDefinition; public ChangeBarDefinition ChangeBarDefinition { get { return _ChangeBarDefinition; } set { _ChangeBarDefinition = value; } } #endregion private PdfLayer _TextLayer; public PdfLayer TextLayer { get { return _TextLayer; } set { _TextLayer = value; } } private PdfLayer _DebugLayer; public PdfLayer DebugLayer { get { return _DebugLayer; } set { _DebugLayer = value; } } private VEPROMS.CSLA.Library.SectionInfo _MySection; public VEPROMS.CSLA.Library.SectionInfo MySection { get { return _MySection; } set { _MySection = value; MySectionTitle = ((_MySection.DisplayNumber ?? "")=="" ? "" : _MySection.DisplayNumber + " - ") + _MySection.DisplayText; MySvg = BuildSvg(_MySection); } } private string _MySectionTitle; public string MySectionTitle { get { return _MySectionTitle; } set { _MySectionTitle = value; } } private int _MaxRNO; public int MaxRNO { get { if (_MaxRNO == 0) _MaxRNO = _MySection.ColumnMode; return _MaxRNO; } } private int _CurrentPageOf = 0; public int CurrentPageOf { get { return _CurrentPageOf; } set { _CurrentPageOf = value; } } private string _Rev = string.Empty; public string Rev { get { return _Rev; } set { _Rev = value; } } private string _RevDate = string.Empty; public string RevDate { get { return _RevDate; } set { _RevDate = value; } } private List _MyChangeBars = new List(); public List MyChangeBars { get { return _MyChangeBars; } set { _MyChangeBars = value; } } public void AddChangeBar(vlnChangeBar vcb, string cbmess) { if (vcb == null) return; vlnChangeBar prevCB = null; foreach (vlnChangeBar cb in MyChangeBars) { // only look at changebars in same column if (cb.XOffset == vcb.XOffset) { // if the two change bars end at same location, set prevCB which will // adjust the length (top position) of the change bar. This condition // also flags that the change bar texts overlap. if (cb.YChangeBarBottom == vcb.YChangeBarBottom) prevCB = cb; // continuous case, if changes bars overlap, adjust size and don't add new one to // the MyChangeBars list. if (MySection.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ContinuousChangeBars) { if (OverlapOrSpan(cb, vcb)) { if (prevCB == null) prevCB = cb; else if (prevCB.YChangeBarBottom > cb.YChangeBarBottom) prevCB = cb; } } } } // if this and the prevCB overlap, adjust yoffset/height/ybottom in the prevCB so that both change bars are // included in this Dictionary item. A new vlnChangeBar is not added to the MyChangeBars list, the current // one that overlaps with the new is adjusted. if (prevCB != null) { // Bottom for both change bars is same, adjust top (YOffset) and height. if (prevCB.YChangeBarBottom == vcb.YChangeBarBottom) { prevCB.YOffset = Math.Max(prevCB.YOffset, vcb.YOffset); float yChangeBarBottomExtend = prevCB.YChangeBarBottomExtend; prevCB.Height = Math.Max(prevCB.Height, vcb.Height); prevCB.YExtendLine = prevCB.YChangeBarBottom - Math.Min(yChangeBarBottomExtend, vcb.YChangeBarBottomExtend); //Math.Max(prevCB.YExtendLine, vcb.YExtendLine); // if a change bar message at this ychangebarbottom exists, see which message is used if (cbmess != null && prevCB.Messages.ContainsKey(prevCB.YChangeBarBottom)) UpdateCbMessage(cbmess, prevCB, vcb.XOffset); return; } // Bottom locations are not the same, but another change bar is not added, i.e. the // length of the line is adjusted. prevCB.YOffset = Math.Max(prevCB.YOffset, vcb.YOffset); float yChangeBarBottomExtend1 = prevCB.YChangeBarBottomExtend; prevCB.YChangeBarBottom = Math.Min(prevCB.YChangeBarBottom, vcb.YChangeBarBottom); prevCB.YExtendLine = prevCB.YChangeBarBottom - Math.Min(yChangeBarBottomExtend1, vcb.YChangeBarBottomExtend); //Math.Max(prevCB.YExtendLine, vcb.YExtendLine); // Two messages at this location, determine which one to use if (cbmess != null && prevCB.Messages.ContainsKey(prevCB.YChangeBarBottom)) UpdateCbMessage(cbmess, prevCB, vcb.XOffset); // no message at this location, just add it. else if (cbmess != null) prevCB.Messages.Add(vcb.YChangeBarBottom, new vlnChangeBarMessage(vcb.MyParent.XOffset, cbmess)); return; } // There was no overlap, add a message if it exists, and then add the change bar to the MyChangeBars list. if (cbmess != null) vcb.Messages.Add(vcb.YChangeBarBottom, new vlnChangeBarMessage(vcb.MyParent.XOffset, cbmess)); MyChangeBars.Add(vcb); } private static void UpdateCbMessage(string cbmess, vlnChangeBar prevCB, float xoff) { // If there are two messages at the same location, for example an AER change bar & and RNO // change bar, and the messages have different text, see which change bar message should be // added, i.e. use the one in 'rno', the greatest x value. vlnChangeBarMessage tmp = prevCB.Messages[prevCB.YChangeBarBottom]; if (cbmess != tmp.Message) { if (xoff > tmp.ParentX) { prevCB.Messages.Remove(prevCB.YChangeBarBottom); prevCB.Messages.Add(prevCB.YChangeBarBottom, new vlnChangeBarMessage(xoff, cbmess)); } } } private bool OverlapOrSpan(vlnChangeBar cb, vlnChangeBar vcb) { if (cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false; // cb.Yoffset is within range of vcb: if (cb.YOffset <= vcb.YOffset && cb.YOffset >= (vcb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true; // cb.YChangeBarBottom is within range of vcb: if ((cb.YChangeBarBottomExtend-vlnPrintObject.SixLinesPerInch) <= vcb.YOffset && cb.YChangeBarBottomExtend >= (vcb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true; // vcb.Yoffset is within range of cb: if (vcb.YOffset <= cb.YOffset && vcb.YOffset >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true; // vcb.YChangeBarBottom is within range of cb: if ((vcb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch) <= cb.YOffset && vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true; return false; } public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection) : base() { MySection = mySection; } private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection) { VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat; VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle; Volian.Svg.Library.Svg mySvg = null; mySvg = SvgSerializer.StringDeserialize(BuildMyText(activeFormat)); mySvg.ViewBox.Height = 1100; mySvg.ViewBox.Width = 850; mySvg.Height = new SvgMeasurement(11, E_MeasurementUnits.IN); mySvg.Width = new SvgMeasurement(8.5F, E_MeasurementUnits.IN); mySvg.LeftMargin = (float)docStyle.Layout.LeftMargin; mySvg.TopMargin = 9.6F; VEPROMS.CSLA.Library.PageStyle pageStyle = docStyle.pagestyle; AddPageListItems(mySvg, pageStyle, mySection); mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText); return mySvg; } PageCounts MyPageCounts = null; private static Regex regexFindToken = new Regex("{[^{}]*}"); private string mySvg_ProcessText(object sender, SvgProcessTextArgs args) { if (!args.MyText.Contains("{")) return args.MyText; /* * Check if tokens for handling page counts ({PAGE} {OF} etc). if so, do templates. */ if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}")) { /* public enum E_NumberingSequence : uint { NoPageNum = 0, WithSteps = 1, Add to original steps section page count. WithinEachDocStyle = 2, WithinEachSection = 3, WithinEachDocStyle1 = 4, GroupedByPagination = 5, GroupedByLevel = 6, WithStepsAndSecondaryPageNumber = 7, WithStepsAndSecondaryPageNumberGroupedByLevel = 8, Like6_ButDoesntNeedSubsection = 9, Like6_ButDoesntNeedSubsection1 = 10 }; */ // default for the key is to make it NumberingSequence. Then handle // specific cases. string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString(); E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0; switch (numseq) { case E_NumberingSequence.WithSteps: // Number with 'originalstepsection' ProcedureInfo pc = MySection.MyProcedure; int sectid = 0; foreach (SectionInfo si in pc.Sections) { SectionConfig sc = si.MyConfig as SectionConfig; if (sc.Section_OriginalSteps == "Y") { sectid = si.ItemID; break; } } if (sectid != 0) key = (int)E_NumberingSequence.WithinEachSection + "." + sectid; break; case E_NumberingSequence.WithinEachDocStyle: key = key + "." + MySection.ActiveFormat.FormatID + "." + MySection.MyDocStyle.Index; break; case E_NumberingSequence.WithinEachSection: key = key + "." + MySection.ItemID; break; } MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); return string.Empty; } return regexFindToken.Replace(args.MyText, new MatchEvaluator(ReplacePageListToken)); } private string BuildMyText(VEPROMS.CSLA.Library.FormatInfo activeFormat) { string sGenMac = activeFormat.GenMac; if (!sGenMac.Contains("xmlns")) sGenMac = sGenMac.Replace(".StringSerialize(mySvg); XmlDocument xDocPrintout = new XmlDocument(); xDocPrintout.LoadXml(str); XmlNode xn = xDocPrintout.DocumentElement.ChildNodes[0]; xn.AppendChild(xDocPrintout.ImportNode(xDocGenMac.DocumentElement, true)); return xDocPrintout.OuterXml; } private string FirstAndLast(string token) { // strip the curly braces and return the first and last character // For example Header1 becomes H1 and Box2 becomes B2 return token.Substring(1, 1) + token.Substring(token.Length - 2, 1); } private static Regex regexJustTokens = new Regex(@"^{([^{}\?]*}{)*[^{}\?]*}$"); private void AddPageListItems(Volian.Svg.Library.Svg mySvg, VEPROMS.CSLA.Library.PageStyle pageStyle, VEPROMS.CSLA.Library.SectionInfo section) { SvgGroup svgGroup = new SvgGroup(); foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems) { if (regexJustTokens.IsMatch(pageItem.Token)) { MatchCollection matches = regexFindToken.Matches(pageItem.Token); foreach (Match match in matches) { string token = match.Value; switch (match.Value) { case "{HEADER1}": case "{HEADER2}": case "{HEADER3}": case "{HEADER4}": case "{HEADER5}": case "{BOX1}": case "{BOX2}": case "{BOX3}": case "{BOX4}": case "{BOX5}": case "{BOX6}": case "{BOX7}": case "{BOX8}": svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token))); break; case "{DRAFTPAGE}": case "{REFERENCEPAGE}": case "{MASTERPAGE}": case "{SAMPLEPAGE}": //mySvg.SetValidWaterMark(token, _Watermark); // Need logic to limit watermark to tokens. break; case "{PROCTITLE}": SplitTitle(svgGroup, pageItem, section.MyProcedure.DisplayText, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength); break; case "{EOPNUM}": svgGroup.Add(PageItemToSvgText(pageItem, section.MyProcedure.DisplayNumber)); break; case "{SECTIONLEVELTITLE}": SplitTitle(svgGroup, pageItem, section.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength); svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText)); break; case "{SECTIONLEVELNUMBER}": svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayNumber)); break; default: Console.WriteLine("Token not processed {0}", token); break; } } } else { svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token)); } } mySvg.Add(svgGroup); } private void SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len) { // TODO: need to calculate len in either points or inches and use the font from the pageItem to determine the number of characters if (len == null || title.Length < len) { svgGroup.Add(PageItemToSvgText(pageItem, title)); return; } // Otherwise determine how many line to split the text into List titleLines = SplitText(title, (int)len); // Move up 6 Points per line to find the starting point float yOffset = -6 * (titleLines.Count - 1); foreach (string line in titleLines) { svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); yOffset += 12; } } private List SplitText(string title, int len) { List retval = new List(); int strlen = title.Length; int start = 0; while ((strlen - start) > len) { int width = FindWidth(title, start, len); retval.Add(title.Substring(start, width)); start += width; while (title[start] == ' ') start++; } if (strlen - start > 0) retval.Add(title.Substring(start, strlen - start)); return retval; } private int FindWidth(string title, int start, int len) { for (int ii = start + len; ii > start; ii--) { if (title[ii] == ' ') { while (title[ii] == ' ') ii--; if (ii > start) return 2 + ii - start; return len; } } return len; } private SvgPart PageItemToSvgUse(VEPROMS.CSLA.Library.PageItem pageItem, string templateName) { SvgUse svgUse = new SvgUse(); svgUse.UseID = templateName; svgUse.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); svgUse.Y = new SvgMeasurement((float)(pageItem.Row ?? 0), E_MeasurementUnits.PT); return svgUse; } private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text) { SvgText svgText = new SvgText(); svgText.Text = text; VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft; if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft) svgText.Justify = SvgJustify.Left; else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight) svgText.Justify = SvgJustify.Right; else svgText.Justify = SvgJustify.Center; svgText.Font = pageItem.Font.WindowsFont; svgText.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); svgText.Y = new SvgMeasurement((float)(pageItem.Row ?? 0), E_MeasurementUnits.PT); if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace return svgText; } private SvgPart PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, float yOffset) { SvgText svgText = new SvgText(); svgText.Text = text; VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft; if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft) svgText.Justify = SvgJustify.Left; else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight) svgText.Justify = SvgJustify.Right; else svgText.Justify = SvgJustify.Center; svgText.Font = pageItem.Font.WindowsFont; svgText.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); svgText.Y = new SvgMeasurement((float)(yOffset + pageItem.Row ?? 0), E_MeasurementUnits.PT); if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace return svgText; } private List _MissingTokens = new List(); protected override string ReplacePageListToken(Match match) { switch (match.Value) { case "{PAGE}": // Current Page Number return CurrentPageNumber.ToString(); case "{OF}": // Total Page Count for this section return CurrentPageOf.ToString(); case "{REVDATE}": // Revision Date return RevDate; case "{REV}": // Revision Number return Rev; } if (!_MissingTokens.Contains(match.Value)) { _MissingTokens.Add(match.Value); Console.WriteLine("\t\t\t\tcase \"{0}\": // Unhandled Token\r\n\t\t\t\t\treturn \"\";", match.Value); } return ""; } } public class VlnDestinations : List { public VlnDestinations() : base() { } public void Add(string title, PdfDestination pdfDestination) { Add(new VlnDestination(title, pdfDestination)); } } public class VlnDestination { private string _Title; public string Title { get { return _Title; } set { _Title = value; } } private PdfDestination _PdfDestination; public PdfDestination PdfDestination { get { return _PdfDestination; } set { _PdfDestination = value; } } public VlnDestination(string title, PdfDestination pdfDestination) { _Title = title; _PdfDestination = pdfDestination; } } public class ChangeBarDefinition // anything that is section level should go in here. { private PrintChangeBar _MyChangeBarType; public PrintChangeBar MyChangeBarType { get { return _MyChangeBarType; } set { _MyChangeBarType = value; } } private PrintChangeBarLoc _MyChangeBarLoc; public PrintChangeBarLoc MyChangeBarLoc { get { return _MyChangeBarLoc; } set { _MyChangeBarLoc = value; } } private PrintChangeBarText _MyChangeBarText; public PrintChangeBarText MyChangeBarText { get { return _MyChangeBarText; } set { _MyChangeBarText = value; } } private string _MyChangeBarMessage; // user defined change bar message from docconfig public string MyChangeBarMessage { get { return _MyChangeBarMessage; } set { _MyChangeBarMessage = value; } } private int _MyChangeBarColumn; // two dimensional array, if both on same side, values are = public int MyChangeBarColumn { get { return _MyChangeBarColumn; } set { _MyChangeBarColumn = value; } } /* * could have line thickness (set default from 16-bit), line color (set default as black), line style */ public ChangeBarDefinition() { } public ChangeBarDefinition(PrintChangeBar myCBT, PrintChangeBarLoc myCBL, PrintChangeBarText myCBTxt, string myCBMsg) { _MyChangeBarType = myCBT; _MyChangeBarLoc = myCBL; _MyChangeBarText = myCBTxt; } public ChangeBarDefinition(DocVersionConfig docverConfig, FormatInfo formatInfo) { // if there is not overridden data on the docversion, prompt user... ChangeBarData changeBarData = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData; if (docverConfig == null || docverConfig.Print_ChangeBar == PrintChangeBar.SelectBeforePrinting) { // use these for now, i.e. this is what user would have selected from dialog. _MyChangeBarType = PrintChangeBar.WithDefault; _MyChangeBarLoc = PrintChangeBarLoc.OutsideBox; _MyChangeBarText = PrintChangeBarText.None; } else { _MyChangeBarType = docverConfig.Print_ChangeBar; _MyChangeBarLoc = docverConfig.Print_ChangeBarLoc; _MyChangeBarText = docverConfig.Print_ChangeBarText; } if (_MyChangeBarType == PrintChangeBar.WithDefault) // get data from format { _MyChangeBarText = changeBarData.ChangeBarMessage == "ChgID" ? PrintChangeBarText.ChgID : changeBarData.ChangeBarMessage == "DateAndChgID" ? PrintChangeBarText.DateChgID : changeBarData.ChangeBarMessage == "None" ? PrintChangeBarText.None : changeBarData.ChangeBarMessage == "RevNum" ? PrintChangeBarText.RevNum : PrintChangeBarText.UserDef; } if (_MyChangeBarType != PrintChangeBar.Without) { // if the format has the absolutefixedchangecolumn format flag, then always use the fixedchangecolumn from the // format, otherwise, use the default column based on the selected location, stored in the base format. _MyChangeBarColumn = (changeBarData.AbsoluteFixedChangeColumn) ? (int)changeBarData.FixedChangeColumn : System.Convert.ToInt32(changeBarData.DefaultCBLoc.Split(" ".ToCharArray())[System.Convert.ToInt32(_MyChangeBarLoc)]); if (_MyChangeBarText == PrintChangeBarText.UserDef) _MyChangeBarMessage = docverConfig.Print_UserCBMess1 + @"\n" + docverConfig.Print_UserCBMess2; } } } }