diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 8c54bcfd..93ad460c 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -128,10 +128,6 @@ namespace VEPROMS MyProcedure = procedureInfo; InitializeComponent(); this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber; - - //Preset path for single procedures. - PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database; - txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_")); _UnitIndex = unitIndex; if (_UnitIndex > 0) @@ -140,6 +136,10 @@ namespace VEPROMS MyProcedure.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex; FormClosed += RemoveUnit_OnClose; } + + //Preset path for single procedures. + PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database; + txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_")); } private void dlgExportImport_Load(object sender, EventArgs e) { @@ -1972,39 +1972,46 @@ namespace VEPROMS private string ResolveMultiUnitROs(ContentInfo ci) { string ciText = ci.Text; - - if (_UnitIndex != 0 && ci.ContentRoUsageCount > 0) + DocVersionInfo docver = null; + if (MyProcedure?.MyDocVersion != null) { - ROFSTLookup lookup = null; - if (MyProcedure?.MyDocVersion != null) - { - lookup = MyProcedure.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyProcedure.MyDocVersion); - } - else if (MyDocVersion != null) - { - lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion); - } - else if (MyFolder.FolderDocVersions != null && MyFolder.FolderDocVersions.Count > 0) - { - lookup = MyFolder.FolderDocVersions[0].DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyFolder.FolderDocVersions[0]); - } + docver = MyProcedure.MyDocVersion; + } + else if (MyDocVersion != null) + { + docver = MyDocVersion; + } + else if (MyFolder.FolderDocVersions != null && MyFolder.FolderDocVersions.Count > 0) + { + docver = MyFolder.FolderDocVersions[0]; + } - if (lookup != null) + + if (_UnitIndex != 0 && docver != null) + { + ciText = DisplayText.ResolveUnitSpecific(docver, ciText); + + if (ci.ContentRoUsageCount > 0) { - foreach (var RO in ci.ContentRoUsages) + ROFSTLookup lookup = docver.DocVersionAssociations[0].MyROFst.GetROFSTLookup(docver); + + if (lookup != null) { - string roid = ROFSTLookup.FormatRoidKey(RO.ROID, true); - ROFSTLookup.rochild roc = lookup.GetRoChild(roid); - //need to search / replace in content info - string lookFor = string.Format(@"()", RO.ROUsageID); - Match m = Regex.Match(ciText, lookFor, RegexOptions.Singleline); - if (m != null && m.Groups.Count > 1) + foreach (var RO in ci.ContentRoUsages) { - ciText = ciText.Replace($"{m.Groups[1].Value}{m.Groups[5].Value}{m.Groups[6].Value}", $"{m.Groups[1].Value}{roc.value}{m.Groups[6].Value}"); + string roid = ROFSTLookup.FormatRoidKey(RO.ROID, true); + ROFSTLookup.rochild roc = lookup.GetRoChild(roid); + //need to search / replace in content info + string lookFor = string.Format(@"()", RO.ROUsageID); + Match m = Regex.Match(ciText, lookFor, RegexOptions.Singleline); + if (m != null && m.Groups.Count > 1) + { + ciText = ciText.Replace($"{m.Groups[1].Value}{m.Groups[5].Value}{m.Groups[6].Value}", $"{m.Groups[1].Value}{roc.value}{m.Groups[6].Value}"); + } } } - } + } } diff --git a/PROMS/VEPROMS User Interface/dlgExportImportEP.cs b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs index 0715d8b5..a310e864 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImportEP.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs @@ -115,6 +115,12 @@ namespace VEPROMS if (epexportblank || !string.IsNullOrEmpty(val)) { + + if (_UnitIndex != 0) + { + val = DisplayText.ResolveUnitSpecific(ii.MyDocVersion, val); + } + XmlElement xindivid = xe.OwnerDocument.CreateElement(EP.name); //need to resolve ROs ROSingle, ROMulti, in text @@ -140,14 +146,14 @@ namespace VEPROMS //XML element with the same xml name as the AccID foreach (Match m in matches) { - ROFSTLookup.rochild roc = lookup.GetROChildByAccPageID(m.Groups[1].Value); + ROFSTLookup.rochild roc = lookup.GetROChildByAccPageID(m.Groups[0].Value); // Exclude replacing Images since are binary - for those, add a sub item if (Enumerable.Range(8, 15).Contains(roc.type)) { xindivid.InnerText = val; - XmlElement xroid = AddGraphic(xindivid, m.Groups[1].Value, roc, myRODB, roc.type != 8); + XmlElement xroid = AddGraphic(xindivid, m.Groups[0].Value, roc, myRODB, roc.type != 8); xindivid.AppendChild(xroid); } @@ -159,7 +165,7 @@ namespace VEPROMS rocvalue = rocvalue.Replace("\xF8", "\xB0"); rocvalue = rocvalue.Replace("\x7F", "\x394"); //delta if (convertCaretToDeltaSymbol) rocvalue = rocvalue.Replace("^", "\x394"); // delta - val = val.Replace($"<{m.Groups[1].Value}>", rocvalue); + val = val.Replace($"{m.Groups[0].Value}", rocvalue); xindivid.InnerText = val; } } @@ -288,6 +294,8 @@ namespace VEPROMS // - that has an attribute designating the location of the image file private XmlElement AddGraphic(XmlElement xindivid, string Name, ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti) { + Name = Name.Replace("<", "").Replace(">", ""); + XmlElement xroid = xindivid.OwnerDocument.CreateElement(Name); string imgfile = GetROImageFileLocation(roc, rodb, isMulti);