This commit is contained in:
Kathy Ruffing 2011-01-19 16:06:46 +00:00
parent 7c5ebdaecc
commit 8a7e5bcc18

View File

@ -370,22 +370,32 @@ namespace VEPROMS.CSLA.Library
string fileName = GetFileName(sect); string fileName = GetFileName(sect);
FileInfo fi = new FileInfo(fileName); FileInfo fi = new FileInfo(fileName);
FileStream fs = fi.Create(); FileStream fs = fi.Create();
fs.Write(mydoc.DocPdf, 0, mydoc.DocPdf.Length); if (mydoc.DocPdf!=null)fs.Write(mydoc.DocPdf, 0, mydoc.DocPdf.Length);
fs.Close(); fs.Close();
return fileName; return fileName;
} }
public static void UpdateDocPdf(DocumentInfo mydoc, Color overrideColor) public static bool UpdateDocPdf(DocumentInfo mydoc, Color overrideColor)
{ {
if (mydoc.DocPdf == null || overrideColor.ToArgb() != mydoc.DocumentConfig.Printing_Color.ToArgb()) if (mydoc.DocPdf == null || overrideColor.ToArgb() != mydoc.DocumentConfig.Printing_Color.ToArgb())
{ {
MSWordToPDF.OverrideColor = overrideColor; MSWordToPDF.OverrideColor = overrideColor;
SetDocPdf(mydoc); return SetDocPdf(mydoc);
} }
return true;
} }
public static void SetDocPdf(DocumentInfo docInfo) public static bool SetDocPdf(DocumentInfo docInfo)
{ {
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(docInfo); string pdfTmp = null;
try
{
pdfTmp = MSWordToPDF.ToPDFReplaceROs(docInfo);
}
catch (Exception ex)
{
return false;
}
if (pdfTmp == null) return false;
FileInfo pdfFile = new FileInfo(pdfTmp); FileInfo pdfFile = new FileInfo(pdfTmp);
FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Byte[] buf = new byte[pdfFile.Length]; Byte[] buf = new byte[pdfFile.Length];
@ -401,6 +411,7 @@ namespace VEPROMS.CSLA.Library
doc.Save(); doc.Save();
} }
docInfo.RefreshConfig(); docInfo.RefreshConfig();
return true;
} }
public static string ToPDFReplaceROs(DocumentInfo doc) public static string ToPDFReplaceROs(DocumentInfo doc)
{ {
@ -492,6 +503,8 @@ namespace VEPROMS.CSLA.Library
sel.Text = string.Format("Bad Image Link (Missing Image File:{0})", vals[0]); sel.Text = string.Format("Bad Image Link (Missing Image File:{0})", vals[0]);
} }
else if ((int)type == 4) // X-Y Plot else if ((int)type == 4) // X-Y Plot
{
try
{ {
val = val.Replace("`", "\xB0"); val = val.Replace("`", "\xB0");
//AddInfo("\tRO Found {0} = '{1}'", sel.Text, val); //AddInfo("\tRO Found {0} = '{1}'", sel.Text, val);
@ -525,6 +538,11 @@ namespace VEPROMS.CSLA.Library
//Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height); //Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height);
//imageROTokenReplaced = true; //imageROTokenReplaced = true;
} }
catch (Exception ex)
{
return null;
}
}
else else
{ {
if (val != null) if (val != null)