This commit is contained in:
parent
125f43d79d
commit
4391cb0d53
746
PROMS/LBWordLibrary/LBWordLibrary/LBComObject.cs
Normal file
746
PROMS/LBWordLibrary/LBWordLibrary/LBComObject.cs
Normal file
@ -0,0 +1,746 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LBWordLibrary
|
||||
{
|
||||
public abstract partial class LBComObject
|
||||
{
|
||||
private Object _Item;
|
||||
internal Object Item
|
||||
{
|
||||
get { return _Item; }
|
||||
set
|
||||
{
|
||||
_Item = value;
|
||||
if (value != null) _MyType = _Item.GetType();
|
||||
}
|
||||
}
|
||||
private Type _MyType;
|
||||
public Type MyType
|
||||
{
|
||||
get { return _MyType; }
|
||||
set { _MyType = value; }
|
||||
}
|
||||
protected LBComObject() { }
|
||||
protected LBComObject(string ProgID)
|
||||
{
|
||||
Type objClassType;
|
||||
objClassType = Type.GetTypeFromProgID(ProgID);
|
||||
Item = Activator.CreateInstance(objClassType);
|
||||
}
|
||||
protected LBComObject(Object item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
private Object DoInvokeMember(string name, Object[] parameters, BindingFlags bf, Binder b)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _MyType.InvokeMember(name, bf, b, _Item, parameters);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(string.Format("{0}.{1} {2} - {3}", _MyType.Name, name, bf.ToString(), ex.GetType().Name));
|
||||
string prefix = "\r\n ";
|
||||
do
|
||||
{
|
||||
sb.Append(prefix + ex.Message);
|
||||
ex = ex.InnerException;
|
||||
} while (ex != null);
|
||||
Console.WriteLine(sb.ToString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected void SetProperty(string propertyName, params Object[] parameters)
|
||||
{
|
||||
DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
|
||||
}
|
||||
protected Object GetProperty(string propertyName)
|
||||
{
|
||||
return DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
|
||||
}
|
||||
protected Object GetProperty(string propertyName, params Object[] parameters)
|
||||
{
|
||||
return DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
|
||||
}
|
||||
protected Object InvokeMethod(string methodName, params Object[] parameters)
|
||||
{
|
||||
return DoInvokeMember(methodName, parameters, BindingFlags.InvokeMethod, null);
|
||||
}
|
||||
protected Object InvokeMethod(string methodName)
|
||||
{
|
||||
return InvokeMethod(methodName, null);
|
||||
}
|
||||
}
|
||||
public class LBComObjectList<TList, TItem> : LBComObject
|
||||
where TList : LBComObjectList<TList, TItem>
|
||||
where TItem : LBComObject, new()
|
||||
{
|
||||
//public new(Object item):base(item){}
|
||||
public TItem Add()
|
||||
{
|
||||
TItem tmp = new TItem();
|
||||
tmp.Item = InvokeMethod("Add");
|
||||
return tmp;
|
||||
}
|
||||
public TItem this[int item]
|
||||
{
|
||||
get
|
||||
{
|
||||
TItem tmp = new TItem();
|
||||
tmp.Item = GetProperty("Item", item);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class LBApplicationClass : LBComObject
|
||||
{
|
||||
public LBApplicationClass() : base("Word.Application") { }
|
||||
public LBApplicationClass(Object item) : base(item) { }
|
||||
public Boolean Visible
|
||||
{
|
||||
get { return (GetProperty("Visible") as Boolean? ?? false); }
|
||||
set { SetProperty("Visible", value); }
|
||||
}
|
||||
public LBDocuments Documents
|
||||
{
|
||||
get { return new LBDocuments(GetProperty("Documents")); }
|
||||
}
|
||||
public LBSelection Selection
|
||||
{
|
||||
get { return new LBSelection(GetProperty("Selection")); }
|
||||
}
|
||||
public LBDocumentClass ActiveDocument
|
||||
{
|
||||
get { return new LBDocumentClass(GetProperty("ActiveDocument")); }
|
||||
}
|
||||
public LBWindow ActiveWindow
|
||||
{
|
||||
get { return new LBWindow(GetProperty("ActiveWindow")); }
|
||||
}
|
||||
public void Quit()
|
||||
{
|
||||
InvokeMethod("Quit", Missing.Value, Missing.Value, Missing.Value);
|
||||
}
|
||||
public void Quit(object SaveChanges, object OriginalFormat, object RouteDocument)
|
||||
{
|
||||
InvokeMethod("Quit", SaveChanges, OriginalFormat, RouteDocument);
|
||||
}
|
||||
}
|
||||
public partial class LBDocuments : LBComObjectList<LBDocuments, LBDocumentClass> /* Collection */
|
||||
{
|
||||
public LBDocuments(Object item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
public LBDocumentClass Open(object FileName)
|
||||
{
|
||||
return new LBDocumentClass(InvokeMethod("Open", FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value));
|
||||
}
|
||||
public LBDocumentClass Open(object FileName, object ConfirmConversions, object ReadOnly, object AddToRecentFiles, object PasswordDocument, object PasswordTemplate, object Revert, object WritePasswordDocument, object WritePasswordTemplate, object Format, object Encoding, object Visible, object OpenAndRepair, object DocumentDirection, object NoEncodingDialog, object XMLTransform)
|
||||
{
|
||||
return new LBDocumentClass(InvokeMethod("Open", FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible, OpenAndRepair, DocumentDirection, NoEncodingDialog, XMLTransform));
|
||||
}
|
||||
}
|
||||
public partial class LBSelection : LBComObject
|
||||
{
|
||||
public LBSelection() { }
|
||||
public LBSelection(Object item) : base(item) { }
|
||||
public LBRange Range
|
||||
{
|
||||
get { return new LBRange(GetProperty("Range")); }
|
||||
}
|
||||
public LBParagraphFormatClass ParagraphFormat
|
||||
{
|
||||
get { return new LBParagraphFormatClass(GetProperty("ParagraphFormat")); }
|
||||
}
|
||||
public String Text
|
||||
{
|
||||
get { return (GetProperty("Text").ToString()); }
|
||||
set { SetProperty("Text", value); }
|
||||
}
|
||||
public LBWdSelectionType Type
|
||||
{
|
||||
get { return (LBWdSelectionType)GetProperty("Type"); }
|
||||
}
|
||||
public LBFind Find
|
||||
{
|
||||
get { return new LBFind(GetProperty("Find")); }
|
||||
}
|
||||
public LBFontClass Font
|
||||
{
|
||||
get { return new LBFontClass(GetProperty("Font")); }
|
||||
}
|
||||
public int End
|
||||
{
|
||||
get { return (GetProperty("End") as int? ?? 0); }
|
||||
set { SetProperty("End", value); }
|
||||
}
|
||||
public int Start
|
||||
{
|
||||
get { return (GetProperty("Start") as int? ?? 0); }
|
||||
set { SetProperty("Start", value); }
|
||||
}
|
||||
public void WholeStory()
|
||||
{
|
||||
InvokeMethod("WholeStory");
|
||||
}
|
||||
public int MoveStart()
|
||||
{
|
||||
return InvokeMethod("MoveStart", Missing.Value, Missing.Value) as int? ?? 0;
|
||||
}
|
||||
public int MoveStart(object Unit, object Count)
|
||||
{
|
||||
return InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
|
||||
}
|
||||
public int MoveEnd()
|
||||
{
|
||||
return InvokeMethod("MoveEnd", Missing.Value, Missing.Value) as int? ?? 0;
|
||||
}
|
||||
public int MoveEnd(object Unit, object Count)
|
||||
{
|
||||
return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
|
||||
}
|
||||
public void Copy()
|
||||
{
|
||||
InvokeMethod("Copy");
|
||||
}
|
||||
}
|
||||
public partial class LBDocumentClass : LBComObject
|
||||
{
|
||||
public LBDocumentClass() { }
|
||||
public LBDocumentClass(Object item) : base(item) { }
|
||||
public LBApplicationClass Application
|
||||
{
|
||||
get { return new LBApplicationClass(GetProperty("Application")); }
|
||||
}
|
||||
public int SaveFormat
|
||||
{
|
||||
get { return (GetProperty("SaveFormat") as int? ?? 0); }
|
||||
}
|
||||
public String FullName
|
||||
{
|
||||
get { return (GetProperty("FullName").ToString()); }
|
||||
}
|
||||
public void SaveAs2000()
|
||||
{
|
||||
InvokeMethod("SaveAs2000", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
|
||||
}
|
||||
public void SaveAs2000(object FileName, object FileFormat, object LockComments, object Password, object AddToRecentFiles, object WritePassword, object ReadOnlyRecommended, object EmbedTrueTypeFonts, object SaveNativePictureFormat, object SaveFormsData, object SaveAsAOCELetter)
|
||||
{
|
||||
InvokeMethod("SaveAs2000", FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter);
|
||||
}
|
||||
public void SaveAs()
|
||||
{
|
||||
InvokeMethod("SaveAs", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
|
||||
}
|
||||
public void SaveAs(object FileName, object FileFormat, object LockComments, object Password, object AddToRecentFiles, object WritePassword, object ReadOnlyRecommended, object EmbedTrueTypeFonts, object SaveNativePictureFormat, object SaveFormsData, object SaveAsAOCELetter, object Encoding, object InsertLineBreaks, object AllowSubstitutions, object LineEnding, object AddBiDiMarks)
|
||||
{
|
||||
InvokeMethod("SaveAs", FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter, Encoding, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks);
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
InvokeMethod("Close", Missing.Value, Missing.Value, Missing.Value);
|
||||
}
|
||||
public void Close(object SaveChanges, object OriginalFormat, object RouteDocument)
|
||||
{
|
||||
InvokeMethod("Close", SaveChanges, OriginalFormat, RouteDocument);
|
||||
}
|
||||
}
|
||||
public partial class LBWindow : LBComObject
|
||||
{
|
||||
public LBWindow() { }
|
||||
public LBWindow(Object item) : base(item) { }
|
||||
public LBPane ActivePane
|
||||
{
|
||||
get { return new LBPane(GetProperty("ActivePane")); }
|
||||
}
|
||||
public LBView View
|
||||
{
|
||||
get { return new LBView(GetProperty("View")); }
|
||||
}
|
||||
}
|
||||
public partial class LBRange : LBComObject
|
||||
{
|
||||
public LBRange() { }
|
||||
public LBRange(Object item) : base(item) { }
|
||||
public LBFontClass Font
|
||||
{
|
||||
get { return new LBFontClass(GetProperty("Font")); }
|
||||
}
|
||||
public LBWdColorIndex HighlightColorIndex
|
||||
{
|
||||
get { return (LBWdColorIndex)GetProperty("HighlightColorIndex"); }
|
||||
set { SetProperty("HighlightColorIndex", value); }
|
||||
}
|
||||
}
|
||||
public partial class LBParagraphFormatClass : LBComObject
|
||||
{
|
||||
public LBParagraphFormatClass() { }
|
||||
public LBParagraphFormatClass(Object item) : base(item) { }
|
||||
public LBWdLineSpacing LineSpacingRule
|
||||
{
|
||||
get { return (LBWdLineSpacing)GetProperty("LineSpacingRule"); }
|
||||
set { SetProperty("LineSpacingRule", value); }
|
||||
}
|
||||
public float LineSpacing
|
||||
{
|
||||
get { return (GetProperty("LineSpacing") as float? ?? 0); }
|
||||
set { SetProperty("LineSpacing", value); }
|
||||
}
|
||||
public float SpaceAfter
|
||||
{
|
||||
get { return (GetProperty("SpaceAfter") as float? ?? 0); }
|
||||
set { SetProperty("SpaceAfter", value); }
|
||||
}
|
||||
public int SpaceAfterAuto
|
||||
{
|
||||
get { return (GetProperty("SpaceAfterAuto") as int? ?? 0); }
|
||||
set { SetProperty("SpaceAfterAuto", value); }
|
||||
}
|
||||
public float SpaceBefore
|
||||
{
|
||||
get { return (GetProperty("SpaceBefore") as float? ?? 0); }
|
||||
set { SetProperty("SpaceBefore", value); }
|
||||
}
|
||||
public int SpaceBeforeAuto
|
||||
{
|
||||
get { return (GetProperty("SpaceBeforeAuto") as int? ?? 0); }
|
||||
set { SetProperty("SpaceBeforeAuto", value); }
|
||||
}
|
||||
}
|
||||
public enum LBWdSelectionType
|
||||
{
|
||||
wdNoSelection = 0,
|
||||
wdSelectionIP = 1,
|
||||
wdSelectionNormal = 2,
|
||||
wdSelectionFrame = 3,
|
||||
wdSelectionColumn = 4,
|
||||
wdSelectionRow = 5,
|
||||
wdSelectionBlock = 6,
|
||||
wdSelectionInlineShape = 7,
|
||||
wdSelectionShape = 8
|
||||
}
|
||||
public partial class LBFind : LBComObject
|
||||
{
|
||||
public LBFind() { }
|
||||
public LBFind(Object item) : base(item) { }
|
||||
public LBReplacement Replacement
|
||||
{
|
||||
get { return new LBReplacement(GetProperty("Replacement")); }
|
||||
}
|
||||
public Boolean Forward
|
||||
{
|
||||
get { return (GetProperty("Forward") as Boolean? ?? false); }
|
||||
set { SetProperty("Forward", value); }
|
||||
}
|
||||
public LBWdFindWrap Wrap
|
||||
{
|
||||
get { return (LBWdFindWrap)GetProperty("Wrap"); }
|
||||
set { SetProperty("Wrap", value); }
|
||||
}
|
||||
public Boolean Format
|
||||
{
|
||||
get { return (GetProperty("Format") as Boolean? ?? false); }
|
||||
set { SetProperty("Format", value); }
|
||||
}
|
||||
public Boolean MatchWholeWord
|
||||
{
|
||||
get { return (GetProperty("MatchWholeWord") as Boolean? ?? false); }
|
||||
set { SetProperty("MatchWholeWord", value); }
|
||||
}
|
||||
public Boolean MatchWildcards
|
||||
{
|
||||
get { return (GetProperty("MatchWildcards") as Boolean? ?? false); }
|
||||
set { SetProperty("MatchWildcards", value); }
|
||||
}
|
||||
public Boolean MatchSoundsLike
|
||||
{
|
||||
get { return (GetProperty("MatchSoundsLike") as Boolean? ?? false); }
|
||||
set { SetProperty("MatchSoundsLike", value); }
|
||||
}
|
||||
public Boolean MatchAllWordForms
|
||||
{
|
||||
get { return (GetProperty("MatchAllWordForms") as Boolean? ?? false); }
|
||||
set { SetProperty("MatchAllWordForms", value); }
|
||||
}
|
||||
public String Text
|
||||
{
|
||||
get { return (GetProperty("Text").ToString()); }
|
||||
set { SetProperty("Text", value); }
|
||||
}
|
||||
public Boolean MatchCase
|
||||
{
|
||||
get { return (GetProperty("MatchCase") as Boolean? ?? false); }
|
||||
set { SetProperty("MatchCase", value); }
|
||||
}
|
||||
public Boolean Execute()
|
||||
{
|
||||
return InvokeMethod("Execute", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value) as Boolean? ?? false;
|
||||
}
|
||||
public Boolean Execute(object FindText, object MatchCase, object MatchWholeWord, object MatchWildcards, object MatchSoundsLike, object MatchAllWordForms, object Forward, object Wrap, object Format, object ReplaceWith, object Replace, object MatchKashida, object MatchDiacritics, object MatchAlefHamza, object MatchControl)
|
||||
{
|
||||
return InvokeMethod("Execute", FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl) as Boolean? ?? false;
|
||||
}
|
||||
public void ClearFormatting()
|
||||
{
|
||||
InvokeMethod("ClearFormatting");
|
||||
}
|
||||
}
|
||||
public partial class LBFontClass : LBComObject
|
||||
{
|
||||
public LBFontClass() { }
|
||||
public LBFontClass(Object item) : base(item) { }
|
||||
public LBWdColor Color
|
||||
{
|
||||
get { return (LBWdColor)GetProperty("Color"); }
|
||||
set { SetProperty("Color", value); }
|
||||
}
|
||||
}
|
||||
public enum LBWdInformation
|
||||
{
|
||||
wdActiveEndAdjustedPageNumber = 1,
|
||||
wdActiveEndSectionNumber = 2,
|
||||
wdActiveEndPageNumber = 3,
|
||||
wdNumberOfPagesInDocument = 4,
|
||||
wdHorizontalPositionRelativeToPage = 5,
|
||||
wdVerticalPositionRelativeToPage = 6,
|
||||
wdHorizontalPositionRelativeToTextBoundary = 7,
|
||||
wdVerticalPositionRelativeToTextBoundary = 8,
|
||||
wdFirstCharacterColumnNumber = 9,
|
||||
wdFirstCharacterLineNumber = 10,
|
||||
wdFrameIsSelected = 11,
|
||||
wdWithInTable = 12,
|
||||
wdStartOfRangeRowNumber = 13,
|
||||
wdEndOfRangeRowNumber = 14,
|
||||
wdMaximumNumberOfRows = 15,
|
||||
wdStartOfRangeColumnNumber = 16,
|
||||
wdEndOfRangeColumnNumber = 17,
|
||||
wdMaximumNumberOfColumns = 18,
|
||||
wdZoomPercentage = 19,
|
||||
wdSelectionMode = 20,
|
||||
wdCapsLock = 21,
|
||||
wdNumLock = 22,
|
||||
wdOverType = 23,
|
||||
wdRevisionMarking = 24,
|
||||
wdInFootnoteEndnotePane = 25,
|
||||
wdInCommentPane = 26,
|
||||
wdInHeaderFooter = 28,
|
||||
wdAtEndOfRowMarker = 31,
|
||||
wdReferenceOfType = 32,
|
||||
wdHeaderFooterType = 33,
|
||||
wdInMasterDocument = 34,
|
||||
wdInFootnote = 35,
|
||||
wdInEndnote = 36,
|
||||
wdInWordMail = 37,
|
||||
wdInClipboard = 38
|
||||
}
|
||||
public partial class LBPane : LBComObject
|
||||
{
|
||||
public LBPane() { }
|
||||
public LBPane(Object item) : base(item) { }
|
||||
public LBPages Pages
|
||||
{
|
||||
get { return new LBPages(GetProperty("Pages")); }
|
||||
}
|
||||
public LBView View
|
||||
{
|
||||
get { return new LBView(GetProperty("View")); }
|
||||
}
|
||||
}
|
||||
public partial class LBView : LBComObject
|
||||
{
|
||||
public LBView() { }
|
||||
public LBView(Object item) : base(item) { }
|
||||
public LBWdViewType Type
|
||||
{
|
||||
get { return (LBWdViewType)GetProperty("Type"); }
|
||||
set { SetProperty("Type", value); }
|
||||
}
|
||||
}
|
||||
public enum LBWdColorIndex
|
||||
{
|
||||
wdNoHighlight = 0,
|
||||
wdBlack = 1,
|
||||
wdBlue = 2,
|
||||
wdTurquoise = 3,
|
||||
wdBrightGreen = 4,
|
||||
wdPink = 5,
|
||||
wdRed = 6,
|
||||
wdYellow = 7,
|
||||
wdWhite = 8,
|
||||
wdDarkBlue = 9,
|
||||
wdTeal = 10,
|
||||
wdGreen = 11,
|
||||
wdViolet = 12,
|
||||
wdDarkRed = 13,
|
||||
wdDarkYellow = 14,
|
||||
wdGray50 = 15,
|
||||
wdGray25 = 16,
|
||||
wdByAuthor = -1
|
||||
}
|
||||
public enum LBWdLineSpacing
|
||||
{
|
||||
wdLineSpaceSingle = 0,
|
||||
wdLineSpace1pt5 = 1,
|
||||
wdLineSpaceDouble = 2,
|
||||
wdLineSpaceAtLeast = 3,
|
||||
wdLineSpaceExactly = 4,
|
||||
wdLineSpaceMultiple = 5
|
||||
}
|
||||
public partial class LBReplacement : LBComObject
|
||||
{
|
||||
public LBReplacement() { }
|
||||
public LBReplacement(Object item) : base(item) { }
|
||||
public String Text
|
||||
{
|
||||
get { return (GetProperty("Text").ToString()); }
|
||||
set { SetProperty("Text", value); }
|
||||
}
|
||||
public void ClearFormatting()
|
||||
{
|
||||
InvokeMethod("ClearFormatting");
|
||||
}
|
||||
}
|
||||
public enum LBWdFindWrap
|
||||
{
|
||||
wdFindStop = 0,
|
||||
wdFindContinue = 1,
|
||||
wdFindAsk = 2
|
||||
}
|
||||
public enum LBWdColor
|
||||
{
|
||||
wdColorBlack = 0,
|
||||
wdColorDarkRed = 128,
|
||||
wdColorRed = 255,
|
||||
wdColorDarkGreen = 13056,
|
||||
wdColorOliveGreen = 13107,
|
||||
wdColorBrown = 13209,
|
||||
wdColorOrange = 26367,
|
||||
wdColorGreen = 32768,
|
||||
wdColorDarkYellow = 32896,
|
||||
wdColorLightOrange = 39423,
|
||||
wdColorLime = 52377,
|
||||
wdColorGold = 52479,
|
||||
wdColorBrightGreen = 65280,
|
||||
wdColorYellow = 65535,
|
||||
wdColorGray95 = 789516,
|
||||
wdColorGray90 = 1644825,
|
||||
wdColorGray875 = 2105376,
|
||||
wdColorGray85 = 2500134,
|
||||
wdColorGray80 = 3355443,
|
||||
wdColorGray75 = 4210752,
|
||||
wdColorGray70 = 5000268,
|
||||
wdColorGray65 = 5855577,
|
||||
wdColorGray625 = 6316128,
|
||||
wdColorDarkTeal = 6697728,
|
||||
wdColorPlum = 6697881,
|
||||
wdColorGray60 = 6710886,
|
||||
wdColorSeaGreen = 6723891,
|
||||
wdColorGray55 = 7566195,
|
||||
wdColorDarkBlue = 8388608,
|
||||
wdColorViolet = 8388736,
|
||||
wdColorTeal = 8421376,
|
||||
wdColorGray50 = 8421504,
|
||||
wdColorGray45 = 9211020,
|
||||
wdColorIndigo = 10040115,
|
||||
wdColorBlueGray = 10053222,
|
||||
wdColorGray40 = 10066329,
|
||||
wdColorTan = 10079487,
|
||||
wdColorLightYellow = 10092543,
|
||||
wdColorGray375 = 10526880,
|
||||
wdColorGray35 = 10921638,
|
||||
wdColorGray30 = 11776947,
|
||||
wdColorGray25 = 12632256,
|
||||
wdColorRose = 13408767,
|
||||
wdColorAqua = 13421619,
|
||||
wdColorGray20 = 13421772,
|
||||
wdColorLightGreen = 13434828,
|
||||
wdColorGray15 = 14277081,
|
||||
wdColorGray125 = 14737632,
|
||||
wdColorGray10 = 15132390,
|
||||
wdColorGray05 = 15987699,
|
||||
wdColorBlue = 16711680,
|
||||
wdColorPink = 16711935,
|
||||
wdColorLightBlue = 16737843,
|
||||
wdColorLavender = 16751052,
|
||||
wdColorSkyBlue = 16763904,
|
||||
wdColorPaleBlue = 16764057,
|
||||
wdColorTurquoise = 16776960,
|
||||
wdColorLightTurquoise = 16777164,
|
||||
wdColorWhite = 16777215,
|
||||
wdColorAutomatic = -16777216
|
||||
}
|
||||
public partial class LBPages : LBComObjectList<LBPages, LBPage> /* Collection */
|
||||
{
|
||||
public LBPages(Object item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return (GetProperty("Count") as int? ?? 0); }
|
||||
}
|
||||
}
|
||||
public enum LBWdViewType
|
||||
{
|
||||
wdNormalView = 1,
|
||||
wdOutlineView = 2,
|
||||
wdPrintView = 3,
|
||||
wdPrintPreview = 4,
|
||||
wdMasterView = 5,
|
||||
wdWebView = 6,
|
||||
wdReadingView = 7
|
||||
}
|
||||
public enum LBWdSaveFormat
|
||||
{
|
||||
wdFormatDocument = 0,
|
||||
wdFormatTemplate = 1,
|
||||
wdFormatText = 2,
|
||||
wdFormatTextLineBreaks = 3,
|
||||
wdFormatDOSText = 4,
|
||||
wdFormatDOSTextLineBreaks = 5,
|
||||
wdFormatRTF = 6,
|
||||
wdFormatEncodedText = 7,
|
||||
wdFormatHTML = 8,
|
||||
wdFormatWebArchive = 9,
|
||||
wdFormatFilteredHTML = 10,
|
||||
wdFormatXML = 11,
|
||||
wdFormatXMLDocument = 12,
|
||||
wdFormatXMLDocumentMacroEnabled = 13,
|
||||
wdFormatXMLTemplate = 14,
|
||||
wdFormatXMLTemplateMacroEnabled = 15,
|
||||
wdFormatDocumentDefault = 16,
|
||||
wdFormatPDF = 17,
|
||||
wdFormatXPS = 18,
|
||||
wdFormatFlatXML = 19,
|
||||
wdFormatFlatXMLMacroEnabled = 20,
|
||||
wdFormatFlatXMLTemplate = 21,
|
||||
wdFormatFlatXMLTemplateMacroEnabled = 22
|
||||
}
|
||||
public enum LBWdFindMatch
|
||||
{
|
||||
wdMatchGraphic = 1,
|
||||
wdMatchCommentMark = 5,
|
||||
wdMatchTabCharacter = 9,
|
||||
wdMatchCaretCharacter = 11,
|
||||
wdMatchColumnBreak = 14,
|
||||
wdMatchField = 19,
|
||||
wdMatchNonbreakingHyphen = 30,
|
||||
wdMatchOptionalHyphen = 31,
|
||||
wdMatchNonbreakingSpace = 160,
|
||||
wdMatchEnDash = 8211,
|
||||
wdMatchEmDash = 8212,
|
||||
wdMatchParagraphMark = 65551,
|
||||
wdMatchFootnoteMark = 65554,
|
||||
wdMatchEndnoteMark = 65555,
|
||||
wdMatchManualPageBreak = 65564,
|
||||
wdMatchAnyDigit = 65567,
|
||||
wdMatchSectionBreak = 65580,
|
||||
wdMatchAnyLetter = 65583,
|
||||
wdMatchAnyCharacter = 65599,
|
||||
wdMatchWhiteSpace = 65655
|
||||
}
|
||||
public enum LBWdReplace
|
||||
{
|
||||
wdReplaceNone = 0,
|
||||
wdReplaceOne = 1,
|
||||
wdReplaceAll = 2
|
||||
}
|
||||
public partial class LBPage : LBComObject
|
||||
{
|
||||
public LBPage() { }
|
||||
public LBPage(Object item) : base(item) { }
|
||||
public LBRectangles Rectangles
|
||||
{
|
||||
get { return new LBRectangles(GetProperty("Rectangles")); }
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get { return (GetProperty("Height") as int? ?? 0); }
|
||||
}
|
||||
public int Left
|
||||
{
|
||||
get { return (GetProperty("Left") as int? ?? 0); }
|
||||
}
|
||||
public int Top
|
||||
{
|
||||
get { return (GetProperty("Top") as int? ?? 0); }
|
||||
}
|
||||
public int Width
|
||||
{
|
||||
get { return (GetProperty("Width") as int? ?? 0); }
|
||||
}
|
||||
}
|
||||
public partial class LBRectangles : LBComObjectList<LBRectangles, LBRectangle> /* Collection */
|
||||
{
|
||||
public LBRectangles(Object item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return (GetProperty("Count") as int? ?? 0); }
|
||||
}
|
||||
}
|
||||
public partial class LBRectangle : LBComObject
|
||||
{
|
||||
public LBRectangle() { }
|
||||
public LBRectangle(Object item) : base(item) { }
|
||||
public LBLines Lines
|
||||
{
|
||||
get { return new LBLines(GetProperty("Lines")); }
|
||||
}
|
||||
}
|
||||
public partial class LBLines : LBComObjectList<LBLines, LBLine> /* Collection */
|
||||
{
|
||||
public LBLines(Object item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return (GetProperty("Count") as int? ?? 0); }
|
||||
}
|
||||
}
|
||||
public partial class LBLine : LBComObject
|
||||
{
|
||||
public LBLine() { }
|
||||
public LBLine(Object item) : base(item) { }
|
||||
public int Top
|
||||
{
|
||||
get { return (GetProperty("Top") as int? ?? 0); }
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get { return (GetProperty("Height") as int? ?? 0); }
|
||||
}
|
||||
}
|
||||
public enum LBWdMovementType
|
||||
{
|
||||
wdMove = 0,
|
||||
wdExtend = 1
|
||||
}
|
||||
public enum LBWdUnits
|
||||
{
|
||||
wdCharacter = 1,
|
||||
wdWord = 2,
|
||||
wdSentence = 3,
|
||||
wdParagraph = 4,
|
||||
wdLine = 5,
|
||||
wdStory = 6,
|
||||
wdScreen = 7,
|
||||
wdSection = 8,
|
||||
wdColumn = 9,
|
||||
wdRow = 10,
|
||||
wdWindow = 11,
|
||||
wdCell = 12,
|
||||
wdCharacterFormatting = 13,
|
||||
wdParagraphFormatting = 14,
|
||||
wdTable = 15,
|
||||
wdItem = 16
|
||||
}
|
||||
}
|
88
PROMS/LBWordLibrary/LBWordLibrary/LBObjectExtension.cs
Normal file
88
PROMS/LBWordLibrary/LBWordLibrary/LBObjectExtension.cs
Normal file
@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LBWordLibrary
|
||||
{
|
||||
public partial class LBDocuments
|
||||
{
|
||||
public LBDocumentClass Open(string fileName, Boolean addToRecentFiles)
|
||||
{
|
||||
return Open(fileName, Missing.Value, Missing.Value, addToRecentFiles);
|
||||
}
|
||||
private LBDocumentClass Open(params object[] myParams)
|
||||
{
|
||||
return new LBDocumentClass(InvokeMethod("Open", myParams));
|
||||
}
|
||||
}
|
||||
public partial class LBDocumentClass : LBComObject
|
||||
{
|
||||
public void SaveAs2000(string fileName)
|
||||
{
|
||||
if (fileName.ToUpper().EndsWith("DOC"))
|
||||
SaveAs2000(fileName, LBWdSaveFormat.wdFormatDocument);
|
||||
else if (fileName.ToUpper().EndsWith("RTF"))
|
||||
SaveAs2000(fileName, LBWdSaveFormat.wdFormatRTF);
|
||||
else
|
||||
SaveAs2000(fileName);
|
||||
}
|
||||
public void SaveAs2000(params object[] myParams)
|
||||
{
|
||||
InvokeMethod("SaveAs2000", myParams);
|
||||
}
|
||||
public void SaveAs(string fileName)
|
||||
{
|
||||
if (fileName.ToUpper().EndsWith("DOC"))
|
||||
SaveAs2(fileName, LBWdSaveFormat.wdFormatDocument, Missing.Value, Missing.Value,false );
|
||||
else if (fileName.ToUpper().EndsWith("RTF"))
|
||||
SaveAs2(fileName, LBWdSaveFormat.wdFormatRTF, Missing.Value, Missing.Value, false);
|
||||
else if (fileName.ToUpper().EndsWith("TXT"))
|
||||
SaveAs2(fileName, LBWdSaveFormat.wdFormatDOSText, Missing.Value, Missing.Value, false);
|
||||
else if (fileName.ToUpper().EndsWith("DOCX"))
|
||||
SaveAs2(fileName, LBWdSaveFormat.wdFormatXMLDocument, Missing.Value, Missing.Value, false);
|
||||
else
|
||||
SaveAs2(fileName, Missing.Value, Missing.Value, Missing.Value, false);
|
||||
}
|
||||
public void SaveAs2(params object[] myParams)
|
||||
{
|
||||
InvokeMethod("SaveAs", myParams);
|
||||
}
|
||||
public void SaveAs(string fileName, LBWdSaveFormat format)
|
||||
{
|
||||
SaveAs2(fileName, format, Missing.Value, Missing.Value, false);
|
||||
}
|
||||
}
|
||||
public partial class LBFind
|
||||
{
|
||||
public void ReplaceAll()
|
||||
{
|
||||
this.Execute(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
|
||||
Missing.Value, Missing.Value, Missing.Value, Missing.Value, LBWdReplace.wdReplaceAll, Missing.Value,
|
||||
Missing.Value, Missing.Value, Missing.Value);
|
||||
}
|
||||
}
|
||||
public partial class LBFontClass : LBComObject
|
||||
{
|
||||
public int TextColor
|
||||
{
|
||||
get { return (int)GetProperty("Color"); }
|
||||
set { SetProperty("Color", value); }
|
||||
}
|
||||
}
|
||||
public partial class LBSelection : LBComObject
|
||||
{
|
||||
public Object get_Information(LBWdInformation info)
|
||||
{
|
||||
return GetProperty("Information", info);
|
||||
}
|
||||
public int MoveStart(LBWdUnits Unit, int Count)
|
||||
{
|
||||
return InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
|
||||
}
|
||||
public int MoveEnd(LBWdUnits Unit, int Count)
|
||||
{
|
||||
return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
52
PROMS/LBWordLibrary/LBWordLibrary/LBWordLibrary.csproj
Normal file
52
PROMS/LBWordLibrary/LBWordLibrary/LBWordLibrary.csproj
Normal file
@ -0,0 +1,52 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{70F23722-19A3-4AC1-A900-55831C945786}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LBWordLibrary</RootNamespace>
|
||||
<AssemblyName>LBWordLibrary</AssemblyName>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="LBComObject.cs" />
|
||||
<Compile Include="LBObjectExtension.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
26
PROMS/LBWordLibrary/LBWordLibrary/LBWordLibrary.sln
Normal file
26
PROMS/LBWordLibrary/LBWordLibrary/LBWordLibrary.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LBWordLibrary", "LBWordLibrary.csproj", "{70F23722-19A3-4AC1-A900-55831C945786}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SourceCodeControl) = preSolution
|
||||
SccNumberOfProjects = 2
|
||||
SccLocalPath0 = .
|
||||
SccProjectUniqueName1 = LBWordLibrary.csproj
|
||||
SccLocalPath1 = .
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{70F23722-19A3-4AC1-A900-55831C945786}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{70F23722-19A3-4AC1-A900-55831C945786}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{70F23722-19A3-4AC1-A900-55831C945786}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{70F23722-19A3-4AC1-A900-55831C945786}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
10
PROMS/LBWordLibrary/LBWordLibrary/LBWordLibrary.vssscc
Normal file
10
PROMS/LBWordLibrary/LBWordLibrary/LBWordLibrary.vssscc
Normal file
@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
|
||||
}
|
35
PROMS/LBWordLibrary/LBWordLibrary/Properties/AssemblyInfo.cs
Normal file
35
PROMS/LBWordLibrary/LBWordLibrary/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LBWordLibrary")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LBWordLibrary")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0bf46b15-747d-427c-a355-9135905fa33b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Loading…
x
Reference in New Issue
Block a user