If the open library document is not referenced, then save changes but don’t generate a PDF.
This commit is contained in:
parent
aea1a3d5f8
commit
008a1e67eb
@ -518,29 +518,32 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//doc.DTS = _MyFile.LastWriteTimeUtc;
|
//doc.DTS = _MyFile.LastWriteTimeUtc;
|
||||||
doc.DTS = DateTime.Now.ToUniversalTime();
|
doc.DTS = DateTime.Now.ToUniversalTime();
|
||||||
doc = doc.Save();
|
doc = doc.Save();
|
||||||
List<string> roids = new List<string>();
|
if (myItemInfo != null) // B2016-131 if myItemInfo is null, the lib doc is not referenced from any procedure. Just save changes, but don't generate a PDF
|
||||||
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo,statusChange);
|
|
||||||
FileInfo pdfFile = new FileInfo(pdfTmp);
|
|
||||||
fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
|
||||||
buf = new byte[pdfFile.Length];
|
|
||||||
fs.Read(buf, 0, buf.Length);
|
|
||||||
fs.Close();
|
|
||||||
pdfFile.Delete();
|
|
||||||
Pdf.DeleteAll(doc.DocID); // clear the PDF table for DocID first
|
|
||||||
DocStyle myDocStyle = myItemInfo.ActiveSection.MyDocStyle;
|
|
||||||
SectionConfig sc = myItemInfo.ActiveSection.MyConfig as SectionConfig;
|
|
||||||
if (sc != null && sc.Section_WordMargin == "Y")
|
|
||||||
{
|
{
|
||||||
using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)myItemInfo.MSWordPageCount, buf)) { ;}
|
List<string> roids = new List<string>();
|
||||||
|
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo, statusChange);
|
||||||
|
FileInfo pdfFile = new FileInfo(pdfTmp);
|
||||||
|
fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
|
buf = new byte[pdfFile.Length];
|
||||||
|
fs.Read(buf, 0, buf.Length);
|
||||||
|
fs.Close();
|
||||||
|
pdfFile.Delete();
|
||||||
|
Pdf.DeleteAll(doc.DocID); // clear the PDF table for DocID first
|
||||||
|
DocStyle myDocStyle = myItemInfo.ActiveSection.MyDocStyle;
|
||||||
|
SectionConfig sc = myItemInfo.ActiveSection.MyConfig as SectionConfig;
|
||||||
|
if (sc != null && sc.Section_WordMargin == "Y")
|
||||||
|
{
|
||||||
|
using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)myItemInfo.MSWordPageCount, buf)) { ;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
||||||
|
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;}
|
||||||
|
}
|
||||||
|
doc.UpdateDRoUsages(roids);
|
||||||
|
doc.Save();
|
||||||
|
if (savLen != _MyFile.Length) _MyLog.ErrorFormat("DSO FRAMER: File size changed during Save for Word Document, beginSize = {0}, endSize = {1}", savLen, _MyFile.Length);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
|
||||||
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;}
|
|
||||||
}
|
|
||||||
doc.UpdateDRoUsages(roids);
|
|
||||||
doc.Save();
|
|
||||||
if (savLen != _MyFile.Length) _MyLog.ErrorFormat("DSO FRAMER: File size changed during Save for Word Document, beginSize = {0}, endSize = {1}", savLen, _MyFile.Length);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user