Compare commits
No commits in common. "4033961323d383979e5d5f2c13aa9ab9b62aa50c" and "118ee9db2874c57484b10b648259da6b513f8513" have entirely different histories.
4033961323
...
118ee9db28
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,8 +613,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
string newvalue = value;
|
string newvalue = value;
|
||||||
// B2023-108: Added check for null reference
|
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
|
||||||
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,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.
|
// 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;
|
||||||
@ -179,13 +180,9 @@ 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;
|
||||||
@ -239,25 +236,19 @@ 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();
|
||||||
|
|
||||||
// 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); // 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);
|
// delete the temporary files
|
||||||
|
|
||||||
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);
|
||||||
if (docInfo == null)
|
_MyLog.ErrorFormat("Error converting Word section to DOCX - ConvertWordSetionToDOXX: ItemID ={0} DOCID={1} LibTitle = {2}", itmInfo, docInfo.DocID, docInfo.LibTitle);
|
||||||
{
|
|
||||||
_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
|
||||||
{
|
{
|
||||||
if (pmsg != null)
|
if (pmsg != null)
|
||||||
pmsg.Close();// close the statue message
|
pmsg.Close();// close the statue message
|
||||||
if (ap != null)
|
if (ap != null)
|
||||||
ap.Quit(); // close the Word app
|
ap.Quit(); // close the Word app
|
||||||
|
@ -1192,7 +1192,7 @@ namespace Volian.Controls.Library
|
|||||||
string linkstr = mro.Groups[2].Value;
|
string linkstr = mro.Groups[2].Value;
|
||||||
string[] roparts = linkstr.Split(" ".ToCharArray());
|
string[] roparts = linkstr.Split(" ".ToCharArray());
|
||||||
ContentRoUsage rousg = null;
|
ContentRoUsage rousg = null;
|
||||||
int oldid = -1;
|
int oldid = -1;
|
||||||
using (Item itm = MyItemInfo.Get())
|
using (Item itm = MyItemInfo.Get())
|
||||||
{
|
{
|
||||||
using (RODb rodb = RODb.GetJustRoDb(Convert.ToInt32(roparts[2])))
|
using (RODb rodb = RODb.GetJustRoDb(Convert.ToInt32(roparts[2])))
|
||||||
@ -1203,7 +1203,7 @@ namespace Volian.Controls.Library
|
|||||||
int newid = Rtf.IndexOf("<NewID>", indx);
|
int newid = Rtf.IndexOf("<NewID>", indx);
|
||||||
Rtf = Rtf.Remove(newid, 7);
|
Rtf = Rtf.Remove(newid, 7);
|
||||||
Rtf = Rtf.Insert(newid, string.Format("<CROUSGID={0}>", rousg.ROUsageID));
|
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());
|
Rtf = Rtf.Replace(string.Format("<CROUSGID={0}>", oldid), rousg.ROUsageID.ToString());
|
||||||
itm.Save();
|
itm.Save();
|
||||||
MyItemInfo.MyContent.RefreshContentRoUsages();
|
MyItemInfo.MyContent.RefreshContentRoUsages();
|
||||||
@ -1265,7 +1265,8 @@ namespace Volian.Controls.Library
|
|||||||
int newidt = Rtf.IndexOf("<NewID>", indx);
|
int newidt = Rtf.IndexOf("<NewID>", indx);
|
||||||
Rtf = Rtf.Remove(newidt, 7);
|
Rtf = Rtf.Remove(newidt, 7);
|
||||||
Rtf = Rtf.Insert(newidt, string.Format("<CTID={0}>", ct.TransitionID));
|
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());
|
Rtf = Rtf.Replace(string.Format("<CTID={0}>", oldidt), ct.TransitionID.ToString());
|
||||||
itm.Save();
|
itm.Save();
|
||||||
MyItemInfo.MyContent.RefreshContentTransitions();
|
MyItemInfo.MyContent.RefreshContentTransitions();
|
||||||
@ -1276,9 +1277,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
MyFlexGrid[r, c] = Rtf;
|
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;
|
c = c + 1;
|
||||||
|
@ -3397,11 +3397,7 @@ namespace Volian.Controls.Library
|
|||||||
// if the paste is below - put back the range for the source location
|
// if the paste is below - put back the range for the source location
|
||||||
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
|
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
|
||||||
MergedRanges.Add(cr);
|
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
|
this[r + rowOffset, c] = MyCopyInfo.MyCopiedFlexGrid[r, c];
|
||||||
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);
|
MatchStyle(crm, cr);
|
||||||
PasteBorders(r + rowOffset, c, r, c);
|
PasteBorders(r + rowOffset, c, r, c);
|
||||||
PasteShading(r + rowOffset, c, r, c); // C2021-004 paste the shading information
|
PasteShading(r + rowOffset, c, r, c); // C2021-004 paste the shading information
|
||||||
@ -3510,11 +3506,7 @@ namespace Volian.Controls.Library
|
|||||||
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
|
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
|
||||||
MergedRanges.Add(cr);
|
MergedRanges.Add(cr);
|
||||||
// copy cell text to the destination, copy the style, copy the cell borders
|
// 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
|
this[r, c + colOffset] = MyCopyInfo.MyCopiedFlexGrid[r, c];
|
||||||
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);
|
MatchStyle(crm, cr);
|
||||||
PasteBorders(r, c + colOffset, r, c);
|
PasteBorders(r, c + colOffset, r, c);
|
||||||
PasteShading(r, c + colOffset, r, c); // C2021-004 paste the shading information
|
PasteShading(r, c + colOffset, r, c); // C2021-004 paste the shading information
|
||||||
@ -3589,20 +3581,16 @@ namespace Volian.Controls.Library
|
|||||||
for (int c = MyCopyInfo.MyCopiedCellRange.c1; c <= Math.Min(MyCopyInfo.MyCopiedCellRange.c2, Cols.Count - 1 - colOffset); c++)
|
for (int c = MyCopyInfo.MyCopiedCellRange.c1; c <= Math.Min(MyCopyInfo.MyCopiedCellRange.c2, Cols.Count - 1 - colOffset); c++)
|
||||||
{
|
{
|
||||||
CellRange crm = MyCopyInfo.MyCopiedFlexGrid.GetMergedRange(r, c);
|
CellRange crm = MyCopyInfo.MyCopiedFlexGrid.GetMergedRange(r, c);
|
||||||
if (r == crm.r1 && c == crm.c1)
|
if (r == crm.r1 && c == crm.c1)
|
||||||
{
|
{
|
||||||
CellRange cr = GetCellRange(crm.r1 + rowOffset, crm.c1 + colOffset, crm.r2 + rowOffset, crm.c2 + colOffset);
|
CellRange cr = GetCellRange(crm.r1 + rowOffset, crm.c1 + colOffset, crm.r2 + rowOffset, crm.c2 + colOffset);
|
||||||
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
|
if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1))
|
||||||
MergedRanges.Add(cr);
|
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
|
this[r + rowOffset, c + colOffset] = MyCopyInfo.MyCopiedFlexGrid[r, c];
|
||||||
if (MyCopyInfo.MyCopiedFlexGrid[r, c] != null)
|
MatchStyle(crm, cr);
|
||||||
this[r + rowOffset, c + colOffset] = ItemInfo.ReplaceLinkWithNewID(MyCopyInfo.MyCopiedFlexGrid[r, c].ToString().Replace("\r\n", ""));
|
PasteBorders(r + rowOffset, c + colOffset, r, c);
|
||||||
else
|
PasteShading(r + rowOffset, c + colOffset, r, c); // C2021-004 paste the shading information
|
||||||
this[r + rowOffset, c + colOffset] = MyCopyInfo.MyCopiedFlexGrid[r, c];
|
}
|
||||||
MatchStyle(crm, cr);
|
|
||||||
PasteBorders(r + rowOffset, c + colOffset, r, c);
|
|
||||||
PasteShading(r + rowOffset, c + colOffset, r, c); // C2021-004 paste the shading information
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.AdjustGridControlSize();
|
this.AdjustGridControlSize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user