Compare commits
20 Commits
118ee9db28
...
4033961323
Author | SHA1 | Date | |
---|---|---|---|
4033961323 | |||
b63db8d513 | |||
fd97a7853d | |||
ca665d9fc8 | |||
0e9d6ac391 | |||
602682b88d | |||
1d52c9f469 | |||
2c93444385 | |||
7b4b6323bf | |||
911a86dbf1 | |||
c5381df38a | |||
e1249dccee | |||
128b5d81cc | |||
ac49c3f297 | |||
7834cf634f | |||
30330c175e | |||
8233f15315 | |||
a5ca7187c7 | |||
ab02e9771e | |||
fcf0ac9843 |
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.
@ -613,7 +613,8 @@ namespace VEPROMS.CSLA.Library
|
||||
return retval;
|
||||
}
|
||||
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>";
|
||||
MatchCollection ms = Regex.Matches(Text, findLink);
|
||||
//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.
|
||||
// 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;
|
||||
@ -180,9 +179,13 @@ 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;
|
||||
@ -236,15 +239,21 @@ namespace VEPROMS.CSLA.Library
|
||||
cfg.MySection.MyContent.MyEntry.MyDocument.MarkDirty();
|
||||
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
|
||||
// delete the temporary files
|
||||
// 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);
|
||||
|
||||
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);
|
||||
_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
|
||||
{
|
||||
|
@ -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();
|
||||
itm.Save(); // this will generate a new ROUsageID that we grab and put in the RO link in the RTF
|
||||
Rtf = Rtf.Replace(string.Format("<CROUSGID={0}>", oldid), rousg.ROUsageID.ToString());
|
||||
itm.Save();
|
||||
MyItemInfo.MyContent.RefreshContentRoUsages();
|
||||
@ -1265,8 +1265,7 @@ 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));
|
||||
//Rtf = Rtf.Replace("<NewID>", string.Format("<CTID={0}>", ct.TransitionID));
|
||||
itm.Save();
|
||||
itm.Save(); // this will generate a new TransitionID that we grab and put in the Transition link in the RTF
|
||||
Rtf = Rtf.Replace(string.Format("<CTID={0}>", oldidt), ct.TransitionID.ToString());
|
||||
itm.Save();
|
||||
MyItemInfo.MyContent.RefreshContentTransitions();
|
||||
@ -1277,6 +1276,9 @@ 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;
|
||||
|
@ -3397,6 +3397,10 @@ 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);
|
||||
@ -3506,6 +3510,10 @@ 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);
|
||||
@ -3586,6 +3594,10 @@ 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user