Compare commits

..

No commits in common. "4033961323d383979e5d5f2c13aa9ab9b62aa50c" and "118ee9db2874c57484b10b648259da6b513f8513" have entirely different histories.

11 changed files with 25 additions and 49 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -613,8 +613,7 @@ namespace VEPROMS.CSLA.Library
return retval;
}
string newvalue = value;
// B2023-108: Added check for null reference
if (newvalue != null) newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);

View File

@ -164,10 +164,11 @@ namespace VEPROMS.CSLA.Library
// B2023-093 This method is called before editing or printing a Word section and will convert it the Word .DOCX format if needed.
// Note that the core logic was taken from frmSectionProperties.cs and modified to convert both .RTF and .DOC files
// The conversion to DOCX is needs to be done only one time per Word section
// B2023-109 Moved the setting of docInfo in the try block to handle if itmInfo, MyContent, MyEntry, MyDocument is null
// Also modified the error log statements in the Catch to put the ItemID and the section number and title out to the error log
public static void ConvertWordSectionToDOCX(ItemInfo itmInfo)
{
// check the Word file extension that is saved in the tblDocuments SQL database table
DocumentInfo docInfo = itmInfo.MyContent.MyEntry.MyDocument;
if (docInfo.FileExtension.ToUpper() == ".DOCX") return; // already a DOCX - no need to convert
FrmPopupStatusMessage pmsg = null;
DSOFile myfile = null;
LBWordLibrary.LBApplicationClass ap = null;
@ -179,13 +180,9 @@ namespace VEPROMS.CSLA.Library
SectionInfo msi = null;
Section sec = null;
SectionConfig cfg = null;
DocumentInfo docInfo = null;
try
{
// check the Word file extension that is saved in the tblDocuments SQL database table
docInfo = itmInfo.MyContent.MyEntry.MyDocument;
if (docInfo.FileExtension.ToUpper() == ".DOCX") return; // already a DOCX - no need to convert
// show user a status window of the Word section being converted to DOCX
// use the section number (DisplayNumber) unless the length is zero, then use the section title (DisplayText)
string statMsg = itmInfo.DisplayNumber;
@ -239,21 +236,15 @@ namespace VEPROMS.CSLA.Library
cfg.MySection.MyContent.MyEntry.MyDocument.MarkDirty();
cfg.MySection.MyContent.MyEntry.Save();
// record in log file (aka error log) that conversion was done
_MyLog.InfoFormat("Converted Word Section to DOCX - Old ID {0} - New ID {1} - {2}", docInfo.DocID, myDoc.DocID, statMsg);
_MyLog.InfoFormat("Converted Word Section to DOCX - Old ID {0} - New ID {1} - {2}", docInfo.DocID, myDoc.DocID, statMsg); // record in log file (aka error log) that conversion was done
// delete the temporary files
FileInfo orgFile = new FileInfo(orgFilename);
orgFile.Delete();// delete the old temporary Word file (.DOC or .RTF)
}
catch (Exception ex)
{
_MyLog.ErrorFormat("Error converting Word section to DOCX - {0}", ex.Message);
if (docInfo == null)
{
_MyLog.ErrorFormat("Error converting Word section to DOCX - ConvertWordSetionToDOXX: ItemID ={0} {1} {2}", itmInfo.ItemID, itmInfo.MyContent.Number, itmInfo.MyContent.Text);
}
else
_MyLog.ErrorFormat("Error converting Word section to DOCX - ConvertWordSetionToDOXX: ItemID ={0} {1} {2} DOCID={3} LibTitle = {4}", itmInfo.ItemID, itmInfo.MyContent.Number, itmInfo.MyContent.Text, docInfo.DocID, docInfo.LibTitle);
_MyLog.ErrorFormat("Error converting Word section to DOCX - ConvertWordSetionToDOXX: ItemID ={0} DOCID={1} LibTitle = {2}", itmInfo, docInfo.DocID, docInfo.LibTitle);
}
finally
{

View File

@ -1203,7 +1203,7 @@ namespace Volian.Controls.Library
int newid = Rtf.IndexOf("<NewID>", indx);
Rtf = Rtf.Remove(newid, 7);
Rtf = Rtf.Insert(newid, string.Format("<CROUSGID={0}>", rousg.ROUsageID));
itm.Save(); // this will generate a new ROUsageID that we grab and put in the RO link in the RTF
itm.Save();
Rtf = Rtf.Replace(string.Format("<CROUSGID={0}>", oldid), rousg.ROUsageID.ToString());
itm.Save();
MyItemInfo.MyContent.RefreshContentRoUsages();
@ -1265,7 +1265,8 @@ namespace Volian.Controls.Library
int newidt = Rtf.IndexOf("<NewID>", indx);
Rtf = Rtf.Remove(newidt, 7);
Rtf = Rtf.Insert(newidt, string.Format("<CTID={0}>", ct.TransitionID));
itm.Save(); // this will generate a new TransitionID that we grab and put in the Transition link in the RTF
//Rtf = Rtf.Replace("<NewID>", string.Format("<CTID={0}>", ct.TransitionID));
itm.Save();
Rtf = Rtf.Replace(string.Format("<CTID={0}>", oldidt), ct.TransitionID.ToString());
itm.Save();
MyItemInfo.MyContent.RefreshContentTransitions();
@ -1276,9 +1277,6 @@ namespace Volian.Controls.Library
}
}
MyFlexGrid[r, c] = Rtf;
// B2022-046 need to save context of each cell in the table after fixing RO and Transition links
// otherwise the RTF for that cell will revert back to previous data then the itm.Save() is called above
SaveContents();
}
}
c = c + 1;

View File

@ -3397,10 +3397,6 @@ namespace Volian.Controls.Library
// if the paste is below - put back the range for the source location
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
MergedRanges.Add(cr);
// B2022-046 if the cell contains an RO or Transition then replace the usage id with <NewID> to force a new usage id in the link
if (MyCopyInfo.MyCopiedFlexGrid[r, c] != null)
this[r + rowOffset, c] = ItemInfo.ReplaceLinkWithNewID(MyCopyInfo.MyCopiedFlexGrid[r, c].ToString().Replace("\r\n", ""));
else
this[r + rowOffset, c] = MyCopyInfo.MyCopiedFlexGrid[r, c];
MatchStyle(crm, cr);
PasteBorders(r + rowOffset, c, r, c);
@ -3510,10 +3506,6 @@ namespace Volian.Controls.Library
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
MergedRanges.Add(cr);
// copy cell text to the destination, copy the style, copy the cell borders
// B2022-046 if the cell contains an RO or Transition then replace the usage id with <NewID> to force a new usage id in the link
if (MyCopyInfo.MyCopiedFlexGrid[r, c] != null)
this[r, c + colOffset] = ItemInfo.ReplaceLinkWithNewID(MyCopyInfo.MyCopiedFlexGrid[r, c].ToString().Replace("\r\n", ""));
else
this[r, c + colOffset] = MyCopyInfo.MyCopiedFlexGrid[r, c];
MatchStyle(crm, cr);
PasteBorders(r, c + colOffset, r, c);
@ -3594,10 +3586,6 @@ namespace Volian.Controls.Library
CellRange cr = GetCellRange(crm.r1 + rowOffset, crm.c1 + colOffset, crm.r2 + rowOffset, crm.c2 + colOffset);
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
MergedRanges.Add(cr);
// B2022-046 if the cell contains an RO or Transition then replace the usage id with <NewID> to force a new usage id in the link
if (MyCopyInfo.MyCopiedFlexGrid[r, c] != null)
this[r + rowOffset, c + colOffset] = ItemInfo.ReplaceLinkWithNewID(MyCopyInfo.MyCopiedFlexGrid[r, c].ToString().Replace("\r\n", ""));
else
this[r + rowOffset, c + colOffset] = MyCopyInfo.MyCopiedFlexGrid[r, c];
MatchStyle(crm, cr);
PasteBorders(r + rowOffset, c + colOffset, r, c);