C2026-007 Upgrade - Generate Missing Word Attachments/B2026-027 Update Refresh Tables For Search Tooltip
This commit is contained in:
@@ -1003,40 +1003,34 @@ namespace VEPROMS.CSLA.Library
|
||||
if (pdfTmp == null) return false;
|
||||
|
||||
FileInfo pdfFile = new FileInfo(pdfTmp);
|
||||
FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
Byte[] buf = new byte[pdfFile.Length];
|
||||
fs.Read(buf, 0, buf.Length);
|
||||
fs.Close();
|
||||
Byte[] buf = new byte[pdfFile.Length];
|
||||
|
||||
// B2023-022 & B2023-023 commented out the deletion of the temporary Word section PDF file
|
||||
// These files are deleted when the procedure pdf file is closed after being generated.
|
||||
// PROMS was crashing because it could not find these temporary files to delete.
|
||||
//try
|
||||
//{
|
||||
// pdfFile.Delete();
|
||||
//}
|
||||
//catch { }
|
||||
|
||||
using (Document doc = docInfo.Get())
|
||||
using (FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
|
||||
SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig;
|
||||
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
|
||||
if (sc != null && sc.Section_WordMargin == "Y")
|
||||
{
|
||||
using (Pdf myPdf = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)sect.MSWordPageCount, buf)) {; }
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Pdf myPdf1 = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
||||
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)sect.MSWordPageCount, buf)) {; }
|
||||
}
|
||||
|
||||
doc.UpdateDRoUsages(roids);
|
||||
doc.Save();
|
||||
fs.Read(buf, 0, buf.Length);
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
using (Document doc = docInfo.Get())
|
||||
{
|
||||
DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
|
||||
SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig;
|
||||
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
|
||||
if (sc != null && sc.Section_WordMargin == "Y")
|
||||
{
|
||||
using (Pdf myPdf = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)sect.MSWordPageCount, buf)) {; }
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Pdf myPdf1 = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
||||
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)sect.MSWordPageCount, buf)) {; }
|
||||
}
|
||||
|
||||
doc.UpdateDRoUsages(roids);
|
||||
doc.Save();
|
||||
}
|
||||
|
||||
docInfo.RefreshConfig();
|
||||
|
||||
return true;
|
||||
@@ -1482,12 +1476,22 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (CloseWordWhenDone)
|
||||
try
|
||||
{
|
||||
if (CloseWordWhenDone)
|
||||
{
|
||||
CloseAppAfterWait();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CloseAppAfterWait();
|
||||
}
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
_MyLog.Error("Failed to close Microsoft Word. Collecting reclaimable memory.", ex);
|
||||
GC.Collect();
|
||||
_MyLog.Warn("Finished collecting reclaimable memory.");
|
||||
}
|
||||
|
||||
if (statusChange != null) statusChange(VolianStatusType.Complete, 0, string.Empty);
|
||||
if (statusChange != null) statusChange(VolianStatusType.Complete, 0, string.Empty);
|
||||
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) Volian.Base.Library.BaselineMetaFile.WriteLine("++EndTxt++");
|
||||
|
||||
// [jpr 2022.07.26] - For memory optimization
|
||||
|
||||
Reference in New Issue
Block a user