Merge pull request 'Development' (#153) from Development into master
Merging F2023-140, F2023-123, B2023-007, B2023-108, F2023-139, F2023-138 and B2023-103
This commit is contained in:
commit
355537f2ab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -613,7 +613,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
string newvalue = value;
|
string newvalue = value;
|
||||||
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
|
// B2023-108: Added check for null reference
|
||||||
|
if (newvalue != null) newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
|
||||||
string findLink = @"<START\].*?\[END>";
|
string findLink = @"<START\].*?\[END>";
|
||||||
MatchCollection ms = Regex.Matches(Text, findLink);
|
MatchCollection ms = Regex.Matches(Text, findLink);
|
||||||
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
|
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
|
||||||
|
@ -164,11 +164,10 @@ 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.
|
// 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
|
// 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
|
// 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)
|
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;
|
FrmPopupStatusMessage pmsg = null;
|
||||||
DSOFile myfile = null;
|
DSOFile myfile = null;
|
||||||
LBWordLibrary.LBApplicationClass ap = null;
|
LBWordLibrary.LBApplicationClass ap = null;
|
||||||
@ -180,9 +179,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
SectionInfo msi = null;
|
SectionInfo msi = null;
|
||||||
Section sec = null;
|
Section sec = null;
|
||||||
SectionConfig cfg = null;
|
SectionConfig cfg = null;
|
||||||
|
DocumentInfo docInfo = null;
|
||||||
try
|
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
|
// 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)
|
// use the section number (DisplayNumber) unless the length is zero, then use the section title (DisplayText)
|
||||||
string statMsg = itmInfo.DisplayNumber;
|
string statMsg = itmInfo.DisplayNumber;
|
||||||
@ -236,15 +239,21 @@ namespace VEPROMS.CSLA.Library
|
|||||||
cfg.MySection.MyContent.MyEntry.MyDocument.MarkDirty();
|
cfg.MySection.MyContent.MyEntry.MyDocument.MarkDirty();
|
||||||
cfg.MySection.MyContent.MyEntry.Save();
|
cfg.MySection.MyContent.MyEntry.Save();
|
||||||
|
|
||||||
_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
|
// record in log file (aka error log) that conversion was done
|
||||||
// delete the temporary files
|
_MyLog.InfoFormat("Converted Word Section to DOCX - Old ID {0} - New ID {1} - {2}", docInfo.DocID, myDoc.DocID, statMsg);
|
||||||
|
|
||||||
FileInfo orgFile = new FileInfo(orgFilename);
|
FileInfo orgFile = new FileInfo(orgFilename);
|
||||||
orgFile.Delete();// delete the old temporary Word file (.DOC or .RTF)
|
orgFile.Delete();// delete the old temporary Word file (.DOC or .RTF)
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_MyLog.ErrorFormat("Error converting Word section to DOCX - {0}", ex.Message);
|
_MyLog.ErrorFormat("Error converting Word section to DOCX - {0}", ex.Message);
|
||||||
_MyLog.ErrorFormat("Error converting Word section to DOCX - ConvertWordSetionToDOXX: ItemID ={0} DOCID={1} LibTitle = {2}", itmInfo, docInfo.DocID, docInfo.LibTitle);
|
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);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user