This commit is contained in:
88
PROMS/LBWordLibrary/LBObjectExtension.cs
Normal file
88
PROMS/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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user