This commit is contained in:
@@ -11,7 +11,7 @@ using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using LBWordLibrary;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
using Volian.Base.Library;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@@ -179,29 +179,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#region Fields
|
||||
private bool _IsDisposed;
|
||||
private static string _TemporaryFolder = null;
|
||||
private DocumentInfo _MyDocument = null;
|
||||
private FileInfo _MyFile = null;
|
||||
private string _Extension = "DOC";
|
||||
#endregion
|
||||
#region Properties
|
||||
public static string TemporaryFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TemporaryFolder == null)
|
||||
{
|
||||
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
|
||||
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VE-PROMS
|
||||
//Vista - C:\Users\{user}\AppData\Local\Temp\VE-PROMS
|
||||
_TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp";
|
||||
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
|
||||
_TemporaryFolder += @"\VE-PROMS";
|
||||
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
|
||||
}
|
||||
return _TemporaryFolder;
|
||||
}
|
||||
}
|
||||
public DocumentInfo MyDocument
|
||||
{
|
||||
get { return _MyDocument; }
|
||||
@@ -268,7 +250,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_MyDocument != null)
|
||||
{
|
||||
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", TemporaryFolder, MyDocument.DocID, Unique, MyDocument.FileExtension));
|
||||
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, MyDocument.DocID, Unique, MyDocument.FileExtension));
|
||||
FileStream fs = _MyFile.Create();
|
||||
if(MyDocument.DocContent != null)fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
|
||||
fs.Close();
|
||||
@@ -502,7 +484,7 @@ namespace VEPROMS.CSLA.Library
|
||||
sel.Text = "";
|
||||
//float width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
|
||||
//float height = 72 * lines / 6.0F;
|
||||
string pngFile = @"C:\Temp\XYPlot1.png";
|
||||
string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
|
||||
RectangleF plotRect = CreatePlot(pngFile, val, 600F, FormForPlotGraphics);
|
||||
//LBShape shape = myDoc.Shapes.AddPicture(@"C:\Temp\XYPlot.png", 0, 0, sel.Range);
|
||||
float x = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
|
||||
@@ -513,6 +495,7 @@ namespace VEPROMS.CSLA.Library
|
||||
float xAdjust = -29.3F; // TODO: Check this value
|
||||
float yAdjust = 9.1F; // TODO: Check this value
|
||||
LBShape shape = myDoc.Shapes.AddPicture(pngFile, x + xAdjust + plotRect.X, yAdjust + y - yTop + plotRect.Y, sel.Range);
|
||||
File.Delete(pngFile);
|
||||
//Console.WriteLine(",{0},{1},{2},{3}", x, y - yTop, xAdjust,yAdjust);
|
||||
shape.LockAspectRatio = LBMsoTriState.msoTrue;
|
||||
//shape.Width = .89F * shape.Width;
|
||||
@@ -576,7 +559,7 @@ namespace VEPROMS.CSLA.Library
|
||||
grfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
grfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
|
||||
grfx.Clear(System.Drawing.Color.Transparent);
|
||||
XYPlots.XYPlot.BlackColor = System.Drawing.Color.Red;
|
||||
XYPlots.XYPlot.BlackColor = VlnSettings.DebugMode ? System.Drawing.Color.Red : System.Drawing.Color.Black;
|
||||
XYPlots.XYPlot myPlot = new XYPlots.XYPlot(xyPlot);
|
||||
myPlot.SetMargins(0, 0, 0, 0);
|
||||
myPlot.Process(new VG.VGOut_Graphics(grfx));
|
||||
@@ -657,7 +640,8 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private static string CreatePDF(string fileName, bool openPdf)
|
||||
{
|
||||
return MyApp.CreatePDF(@"C:\Temp\" + fileName + ".pdf", openPdf);
|
||||
//return MyApp.CreatePDF(@"C:\Temp\" + fileName + ".pdf", openPdf);
|
||||
return MyApp.CreatePDF(VlnSettings.TemporaryFolder + "\\" + fileName + ".pdf", openPdf);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user