Added a missing MAXRECURSION 10000
Changed Through Transition Format and User Interface Added Automatic Print Options to shutoff DebugText (/NT), DebugPagination (/NP) and Compare (/NC) Added logic to allow the use of the default path for PDFs. Update the Print_PDFLocation property of the Working Draft when the user changes the value on the Working Draft property page. Fixed Bug B2013-117 Set the date/time stamp for the Document based upon the current time. Make sure that the output is set to Final without revisions and comments before ROs are replaced. Added function to restore valid previous version of MSWord document if the current version is not a valid document. Check for Null to eliminate errors. Removed Unused field DocPDF Support MSWord document restore function. Add check for Transition Node count before updating values. Restore latest valid MSWord document if the current version is not valid. Eliminate File Commands so that the user can only close the MSWord section, and then verify if the changes to the document will be saved.
This commit is contained in:
@@ -34,6 +34,16 @@ namespace VEPROMS.CSLA.Library
|
||||
return _LibTitle;
|
||||
}
|
||||
}
|
||||
private static LBApplicationClass _MyApp = null;
|
||||
public static LBApplicationClass MyApp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MyApp == null)
|
||||
_MyApp = new LBApplicationClass();
|
||||
return _MyApp;
|
||||
}
|
||||
}
|
||||
public void UpdateDRoUsages(List<string> roids)
|
||||
{
|
||||
_DocumentDROUsageCount = -1;
|
||||
@@ -57,6 +67,94 @@ namespace VEPROMS.CSLA.Library
|
||||
DocumentDROUsages.Add(parts[1], RODb.GetJustRoDb(int.Parse(parts[0])));
|
||||
}
|
||||
}
|
||||
private int _Unique = 0;
|
||||
private string Unique
|
||||
{
|
||||
get
|
||||
{
|
||||
string retval = "";
|
||||
if (_Unique != 0) retval = "_" + _Unique.ToString();
|
||||
_Unique++;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
public void StatusChanged(VolianStatusType type, int count, string text)
|
||||
{
|
||||
//if (Parent != null && Parent.Parent != null && Parent.Parent.Parent is DisplayTabControl)
|
||||
//{
|
||||
// DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl;
|
||||
// tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text));
|
||||
//}
|
||||
}
|
||||
public void RestoreWordDoc(ItemInfo myItemInfo)
|
||||
{
|
||||
DocumentAuditInfo savDocAuditInfo = null;
|
||||
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(DocID))
|
||||
{
|
||||
if (dail.Count > 0)
|
||||
{
|
||||
DocumentAuditInfo dai = dail[0];
|
||||
foreach (DocumentAuditInfo tmpa in dail)
|
||||
{
|
||||
FileInfo tmpFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, DocID, Unique, tmpa.FileExtension));
|
||||
while (tmpFile.Exists)
|
||||
{
|
||||
tmpFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, DocID, Unique, tmpa.FileExtension));
|
||||
}
|
||||
FileStream fs = tmpFile.Create();
|
||||
if (tmpa.DocContent != null) fs.Write(tmpa.DocContent, 0, tmpa.DocContent.Length);
|
||||
fs.Close();
|
||||
LBDocumentClass myDoc = null;
|
||||
try
|
||||
{
|
||||
myDoc = MyApp.Documents.Open(tmpFile.FullName, false);
|
||||
savDocAuditInfo = tmpa;
|
||||
myDoc.Close();
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (myDoc != null) myDoc.Close();
|
||||
continue; // get next document audit item.
|
||||
}
|
||||
}
|
||||
}
|
||||
if (savDocAuditInfo != null)
|
||||
{
|
||||
FileExtension = savDocAuditInfo.FileExtension;
|
||||
DocContent = savDocAuditInfo.DocContent;
|
||||
DocAscii = savDocAuditInfo.DocAscii;
|
||||
Config = savDocAuditInfo.Config;
|
||||
UserID = savDocAuditInfo.UserID;
|
||||
DTS = savDocAuditInfo.DTS;
|
||||
Save();
|
||||
List<string> roids = new List<string>();
|
||||
DocumentInfo docinfo = DocumentInfo.Get(DocID);
|
||||
|
||||
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(docinfo, roids, myItemInfo, StatusChanged);
|
||||
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();
|
||||
pdfFile.Delete();
|
||||
Pdf.DeleteAll(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(this, MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)myItemInfo.MSWordPageCount, buf)) { ;}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Pdf myPdf = Pdf.MakePdf(this, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
||||
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;}
|
||||
}
|
||||
UpdateDRoUsages(roids);
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// FixString processes the string returned and changes any symbols (0xF0??) to normal characters
|
||||
/// </summary>
|
||||
@@ -417,7 +515,8 @@ namespace VEPROMS.CSLA.Library
|
||||
cfg.Edit_Initialized = true;
|
||||
doc.Config = cfg.ToString();
|
||||
doc.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||
doc.DTS = _MyFile.LastWriteTimeUtc;
|
||||
//doc.DTS = _MyFile.LastWriteTimeUtc;
|
||||
doc.DTS = DateTime.Now.ToUniversalTime();
|
||||
doc = doc.Save();
|
||||
List<string> roids = new List<string>();
|
||||
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo,statusChange);
|
||||
@@ -658,7 +757,7 @@ namespace VEPROMS.CSLA.Library
|
||||
LBRange myRange = selxy.Paragraphs.First.Range;
|
||||
float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
|
||||
float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary);
|
||||
|
||||
|
||||
// some data had regular text embedded in the xyplot definition. If so, the plain text must
|
||||
// be left in the file. Otherwise, we can replace with empty text.
|
||||
string resXyPlot = xyplot;
|
||||
@@ -670,8 +769,8 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
selxy.Text = "";
|
||||
if (cnt>0)for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r";
|
||||
selxy.Text = "";
|
||||
if (cnt > 0) for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r";
|
||||
}
|
||||
|
||||
pngFile = VlnSettings.TemporaryFolder + @"\XYPlot" + filecount.ToString() + @".png"; //@"C:\Temp\XYPlot1.png";
|
||||
@@ -694,6 +793,9 @@ namespace VEPROMS.CSLA.Library
|
||||
if(statusChange != null) statusChange(VolianStatusType.Initialize, sel.End, "Refreshing ROs");
|
||||
sel = hasRos ? FindRO() : null;
|
||||
int roCount = 0;
|
||||
// force Print of MS Word Attachment to Final without revisions and comments
|
||||
myDoc.ActiveWindow.View.ShowRevisionsAndComments = false;
|
||||
myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal;
|
||||
while (sel != null)
|
||||
{
|
||||
if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", ++roCount));
|
||||
@@ -817,9 +919,6 @@ namespace VEPROMS.CSLA.Library
|
||||
//sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||
sel.Range.Font.Color = (LBWdColor)WordColor(OverrideColor == System.Drawing.Color.Transparent ? System.Drawing.Color.Black : OverrideColor);
|
||||
sect.MSWordPageCount = myDoc.Length;
|
||||
// force Print of MS Word Attachment to Final without revisions and comments
|
||||
myDoc.ActiveWindow.View.ShowRevisionsAndComments = false;
|
||||
myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal;
|
||||
fileName = CreatePDF(fileName, openPdf);
|
||||
MyApp.ActiveDocument.Close(false);
|
||||
if (CloseWordWhenDone)
|
||||
@@ -987,7 +1086,7 @@ namespace VEPROMS.CSLA.Library
|
||||
, _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath);
|
||||
}
|
||||
else
|
||||
_MyLog.Error("Could not set margins", ex);
|
||||
_MyLog.Error("Could not set margins", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4730,7 +4730,7 @@ namespace VEPROMS.CSLA.Library
|
||||
string tmpstr = indx+1<DisplayNumber.Length?DisplayNumber.Substring(indx+1):null;
|
||||
// if the section's tab is a letter, we don't want a 0 on the section.... for example A.0.
|
||||
if (IsSection && tmpstr == null && System.Char.IsLetter(DisplayNumber, 0)) return -1;
|
||||
if (tmpstr.IndexOf('-') >= 0) return -1;
|
||||
if (tmpstr != null && tmpstr.IndexOf('-') >= 0) return -1;
|
||||
return tmpstr==null?0:System.Convert.ToInt32(tmpstr);
|
||||
}
|
||||
return (-1);
|
||||
|
Reference in New Issue
Block a user