Print Library, Svg Library, Utils Library, XYPlots
This commit is contained in:
@@ -1,108 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LBWordLibrary;
|
||||
|
||||
namespace Volian.MSWord
|
||||
{
|
||||
public class WordDoc
|
||||
{
|
||||
private static LBApplicationClass _MyWordApp;
|
||||
public static LBApplicationClass MyWordApp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MyWordApp == null)
|
||||
_MyWordApp = new LBApplicationClass();
|
||||
return WordDoc._MyWordApp;
|
||||
}
|
||||
}
|
||||
private LBDocumentClass _MyWordDoc;
|
||||
public LBDocumentClass MyWordDoc
|
||||
{
|
||||
get
|
||||
{ return _MyWordDoc; }
|
||||
}
|
||||
private string _DocName;
|
||||
public string DocName
|
||||
{
|
||||
get { return _DocName; }
|
||||
set { _DocName = value; }
|
||||
}
|
||||
public WordDoc(string docName)
|
||||
{
|
||||
DocName = docName;
|
||||
_MyWordDoc = MyWordApp.Documents.Open(_DocName, false);
|
||||
}
|
||||
public string Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
MyWordDoc.SaveAs(DocName, LBWdSaveFormat.wdFormatDocument);
|
||||
return "Successful Save";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return string.Format("Error during Doc save - {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
public string Save(string docName)
|
||||
{
|
||||
DocName = docName;
|
||||
return Save();
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
MyWordDoc.Close(false);
|
||||
}
|
||||
public float SetLineSpacing(float linesPerInch) // if need landscape set too: , bool landscape)
|
||||
{
|
||||
float retval = 0;
|
||||
LBSelection selection = MyWordApp.Selection;
|
||||
selection.WholeStory();
|
||||
retval = selection.ParagraphFormat.LineSpacing;
|
||||
selection.ParagraphFormat.SpaceBefore = 0;
|
||||
selection.ParagraphFormat.SpaceAfter = 0;
|
||||
selection.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly;
|
||||
selection.ParagraphFormat.LineSpacing = 72 / linesPerInch;
|
||||
return retval;
|
||||
}
|
||||
public float Length
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return MyWordDoc.Length;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error Getting Length, {0}", ex.Message);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public static void CloseApp()
|
||||
{
|
||||
if(_MyWordApp != null)
|
||||
{
|
||||
TryToQuit();
|
||||
KillWordApps();
|
||||
}
|
||||
}
|
||||
|
||||
private static void TryToQuit()
|
||||
{
|
||||
try
|
||||
{
|
||||
_MyWordApp.Quit(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||
}
|
||||
_MyWordApp=null;
|
||||
}
|
||||
public static void KillWordApps()
|
||||
{
|
||||
try
|
||||
@@ -124,15 +25,8 @@ namespace Volian.MSWord
|
||||
if(proc.MainWindowTitle=="")
|
||||
proc.Kill();
|
||||
}
|
||||
_MyWordApp = null;
|
||||
}
|
||||
public static System.Diagnostics.Process[] WordProcesses
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.Diagnostics.Process.GetProcessesByName("WINWORD");
|
||||
}
|
||||
}
|
||||
public static System.Diagnostics.Process[] WordProcesses => System.Diagnostics.Process.GetProcessesByName("WINWORD");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@@ -20,12 +18,9 @@ namespace vlnObjectLibrary
|
||||
{
|
||||
/* See if I need to do anything */
|
||||
}
|
||||
#region XML Serialization
|
||||
public void WriteXml(XmlWriter w)
|
||||
{
|
||||
WriteXml(w, true);
|
||||
}
|
||||
public void WriteXml(XmlWriter w,bool bSaveParent)
|
||||
#region XML Serialization
|
||||
public void WriteXml(XmlWriter w) => WriteXml(w, true);
|
||||
public void WriteXml(XmlWriter w,bool bSaveParent)
|
||||
{
|
||||
w.WriteAttributeString("title", Title);
|
||||
w.WriteAttributeString("path", Path);
|
||||
@@ -74,13 +69,10 @@ namespace vlnObjectLibrary
|
||||
xr.Close();
|
||||
}
|
||||
|
||||
public XmlSchema GetSchema()
|
||||
{
|
||||
return (null);
|
||||
}
|
||||
#endregion
|
||||
#region Constructors
|
||||
public vlnObject(vlnObject parent, string type, string title, string path)
|
||||
public XmlSchema GetSchema() => (null);
|
||||
#endregion
|
||||
#region Constructors
|
||||
public vlnObject(vlnObject parent, string type, string title, string path)
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_Type = type;
|
||||
@@ -148,11 +140,8 @@ namespace vlnObjectLibrary
|
||||
vlnObject b = new vlnObject(this, type, title, path);
|
||||
return b;
|
||||
}
|
||||
public void AddProp(string name, string value)
|
||||
{
|
||||
PropArray[name.ToUpper()] = value;
|
||||
}
|
||||
public void AddProp(XmlReader xr)
|
||||
public void AddProp(string name, string value) => PropArray[name.ToUpper()] = value;
|
||||
public void AddProp(XmlReader xr)
|
||||
{
|
||||
SkipToElement(xr);
|
||||
string sName = null;
|
||||
@@ -182,11 +171,8 @@ namespace vlnObjectLibrary
|
||||
m_Children = value;
|
||||
}
|
||||
}
|
||||
public void LoadChildren(string sXml)
|
||||
{
|
||||
LoadChildren(new XmlTextReader(new StringReader(sXml)));
|
||||
}
|
||||
public void LoadChildren(XmlReader xr)
|
||||
public void LoadChildren(string sXml) => LoadChildren(new XmlTextReader(new StringReader(sXml)));
|
||||
public void LoadChildren(XmlReader xr)
|
||||
{
|
||||
m_Children = new List<vlnObject>();
|
||||
SkipToElement(xr);
|
||||
@@ -212,8 +198,6 @@ namespace vlnObjectLibrary
|
||||
}
|
||||
public string ProcessString(string s)
|
||||
{
|
||||
//string retval=s;
|
||||
//string retval = Regex.Replace(s, "{[.]*}", new MatchEvaluator(ReplaceKey));
|
||||
string retval = Regex.Replace(s, "{{.*?}}", new MatchEvaluator(ReplaceRow));
|
||||
retval = Regex.Replace(retval, "{.*?}", new MatchEvaluator(ReplaceDrv));
|
||||
return retval;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using vlnObjectLibrary;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.Reflection;
|
||||
|
||||
namespace vlnServerLibrary
|
||||
{
|
||||
@@ -15,18 +13,10 @@ namespace vlnServerLibrary
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
#region Static Properties
|
||||
private static string m_XmlControlPath = "vlnControl.xml";
|
||||
private static XmlDocument m_XmlControl;
|
||||
public static string XMLControlPath
|
||||
{
|
||||
get { return m_XmlControlPath; }
|
||||
set
|
||||
{
|
||||
m_XmlControlPath = value;
|
||||
}
|
||||
}
|
||||
public static XmlDocument XMLControl
|
||||
#region Static Properties
|
||||
private static XmlDocument m_XmlControl;
|
||||
public static string XMLControlPath { get; set; } = "vlnControl.xml";
|
||||
public static XmlDocument XMLControl
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -35,7 +25,7 @@ namespace vlnServerLibrary
|
||||
m_XmlControl = new XmlDocument();
|
||||
lock (m_XmlControl)
|
||||
{
|
||||
m_XmlControl.Load(m_XmlControlPath);
|
||||
m_XmlControl.Load(XMLControlPath);
|
||||
}
|
||||
}
|
||||
return m_XmlControl;
|
||||
@@ -75,11 +65,8 @@ namespace vlnServerLibrary
|
||||
string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Parent.Type, s);
|
||||
return LookUpX(o,xPath);
|
||||
}
|
||||
protected string LookUpX(vlnObject o,string xPath)
|
||||
{
|
||||
return LookUpX(o,xPath, XMLControl);
|
||||
}
|
||||
private void LoadChildrenFromDB(vlnObject o,string sSelect)
|
||||
protected string LookUpX(vlnObject o, string xPath) => LookUpX(o, xPath, XMLControl);
|
||||
private void LoadChildrenFromDB(vlnObject o,string sSelect)
|
||||
{
|
||||
if (sSelect != "")
|
||||
{
|
||||
@@ -89,7 +76,6 @@ namespace vlnServerLibrary
|
||||
OleDbConnectionStringBuilder csb = new OleDbConnectionStringBuilder(s);
|
||||
OleDbConnection dbConn = new OleDbConnection(csb.ConnectionString);
|
||||
string sTable = LookUp(o,"table");
|
||||
//if (dbConn.State != ConnectionState.Open) dbConn.Open();
|
||||
OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn);
|
||||
DataSet ds = new DataSet();
|
||||
da.Fill(ds, sTable);
|
||||
@@ -222,7 +208,7 @@ namespace vlnServerLibrary
|
||||
string sRetval = sDefault;
|
||||
if (sRetval[0] == '~')
|
||||
{
|
||||
string sTitlePath = sPath + "\\title";
|
||||
string sTitlePath = $"{sPath}\\title";
|
||||
if (File.Exists(sTitlePath))
|
||||
{
|
||||
StreamReader sr = File.OpenText(sTitlePath);
|
||||
|
||||
Reference in New Issue
Block a user