RichTextBox Processing
Output Config Info for Steps
This commit is contained in:
parent
187f98807d
commit
0e66393289
36
PROMS/DataLoader/RichTextBox41.Designer.cs
generated
Normal file
36
PROMS/DataLoader/RichTextBox41.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
namespace DataLoader
|
||||||
|
{
|
||||||
|
partial class RichTextBox41
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
39
PROMS/DataLoader/RichTextBox41.cs
Normal file
39
PROMS/DataLoader/RichTextBox41.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace DataLoader
|
||||||
|
{
|
||||||
|
public partial class RichTextBox41 : RichTextBox
|
||||||
|
{
|
||||||
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
||||||
|
static extern IntPtr LoadLibrary(string lpFileName);
|
||||||
|
protected override CreateParams CreateParams
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CreateParams prams = base.CreateParams;
|
||||||
|
if (LoadLibrary("msftedit.dll") != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
//prams.ExStyle |= 0x020; // transparent
|
||||||
|
prams.ClassName = "RICHEDIT50W";
|
||||||
|
}
|
||||||
|
return prams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public RichTextBox41()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public RichTextBox41(IContainer container)
|
||||||
|
{
|
||||||
|
container.Add(this);
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -76,7 +76,7 @@ namespace DataLoader
|
|||||||
//content = Content.MakeContent(null, stptext, 20000 + int.Parse(newstptyp!=null?newstptyp:StepType),null, ManualPagebreak?ci.ToString():null, dts, userid);
|
//content = Content.MakeContent(null, stptext, 20000 + int.Parse(newstptyp!=null?newstptyp:StepType),null, ManualPagebreak?ci.ToString():null, dts, userid);
|
||||||
// 20000 flags step type item & 1 adjusts for 'base' in format files.
|
// 20000 flags step type item & 1 adjusts for 'base' in format files.
|
||||||
int contenttype = (structtype == "R") ? 20040 : 20001 + int.Parse(newstptyp != null ? newstptyp : StepType);
|
int contenttype = (structtype == "R") ? 20040 : 20001 + int.Parse(newstptyp != null ? newstptyp : StepType);
|
||||||
content = Content.New(null, stptext, contenttype, null, ManualPagebreak ? ci.ToString() : null, dts, userid);
|
content = Content.New(null, stptext, contenttype, null, ci.ToString(), dts, userid);
|
||||||
content.MyZContent.OldStepSequence = ProcNumber + "|" + stpseq;
|
content.MyZContent.OldStepSequence = ProcNumber + "|" + stpseq;
|
||||||
|
|
||||||
// Before we save it, handle RO & Transitions tokens.
|
// Before we save it, handle RO & Transitions tokens.
|
||||||
|
110
PROMS/DataLoader/WordDocument.cs
Normal file
110
PROMS/DataLoader/WordDocument.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Volian.MSWord;
|
||||||
|
using LBWordLibrary;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace DataLoader
|
||||||
|
{
|
||||||
|
class WordDocument
|
||||||
|
{
|
||||||
|
private string _FileName;
|
||||||
|
public string FileName
|
||||||
|
{
|
||||||
|
get { return _FileName; }
|
||||||
|
set { _FileName = value; }
|
||||||
|
}
|
||||||
|
private string _ASCII = null;
|
||||||
|
public string ASCII
|
||||||
|
{
|
||||||
|
get { return _ASCII; }
|
||||||
|
set { _ASCII = value; }
|
||||||
|
}
|
||||||
|
private float _DocLen = 1.0F;
|
||||||
|
public float DocLen
|
||||||
|
{
|
||||||
|
get { return _DocLen; }
|
||||||
|
set { _DocLen = value; }
|
||||||
|
}
|
||||||
|
private string _Stype;
|
||||||
|
/// <summary>
|
||||||
|
/// 16-bit's type[1] used the following codes to represent the respective lpi setting
|
||||||
|
///
|
||||||
|
/// char far typestr[] = "*pP46f7L";
|
||||||
|
///
|
||||||
|
/// char * far printtypes[] = {
|
||||||
|
/// "Compressed, 8 lines per inch",
|
||||||
|
/// "Elite, 6 lines per inch",
|
||||||
|
/// "Pica, 6 lines per inch",
|
||||||
|
/// "Default font, 4 Lines Per Inch",
|
||||||
|
/// "Default font, 6 Lines Per Inch",
|
||||||
|
/// "Compressed 6 LPI",
|
||||||
|
/// "Default font, 7 Lines Per Inch",
|
||||||
|
/// "Special Landscape, Elite, 6 lines per inch"
|
||||||
|
/// </summary>
|
||||||
|
public string Stype
|
||||||
|
{
|
||||||
|
get { return _Stype; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_Stype = value;
|
||||||
|
if (_Stype != null)
|
||||||
|
{
|
||||||
|
if (_Stype != null)
|
||||||
|
{
|
||||||
|
// stype[1] == 'p' or 'P' or '6' 'f' or 'L' get spc = 6
|
||||||
|
if (_Stype[1] == '*') LPI = 8;
|
||||||
|
else if (_Stype[1] == '4') LPI = 4;
|
||||||
|
else if (_Stype[1] == '7') LPI = 7;
|
||||||
|
// if need landscape set too: bool landscape = (stype[1] == 'L');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _LPI = 6;
|
||||||
|
public int LPI
|
||||||
|
{
|
||||||
|
get { return _LPI; }
|
||||||
|
set { _LPI = value; }
|
||||||
|
}
|
||||||
|
private string _OutFileName;
|
||||||
|
public string OutFileName
|
||||||
|
{
|
||||||
|
get { return _OutFileName; }
|
||||||
|
set { _OutFileName = value; }
|
||||||
|
}
|
||||||
|
public WordDocument(string fileName, string stype, string outFileName)
|
||||||
|
{
|
||||||
|
FileName = fileName;
|
||||||
|
Stype = stype;
|
||||||
|
OutFileName = outFileName;
|
||||||
|
}
|
||||||
|
public void GetAsciiFromWord()
|
||||||
|
{
|
||||||
|
WordDoc myWordDoc = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
myWordDoc = new WordDoc(FileName);
|
||||||
|
myWordDoc.SetLineSpacing(LPI);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DocLen = myWordDoc.Length;
|
||||||
|
}
|
||||||
|
catch (Exception ex1)
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0} - {0}\r\n\r\n{1}", ex1.GetType().Name, ex1.Message);
|
||||||
|
}
|
||||||
|
ASCII = myWordDoc.MyWordDoc.Ascii;
|
||||||
|
myWordDoc.Save(OutFileName);
|
||||||
|
myWordDoc.Close();
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Could not get Ascii", ex);
|
||||||
|
WordDoc.CloseApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user