本文整理汇总了C#中System.Windows.Forms.Document.Object方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Object方法的具体用法?C# Document.Object怎么用?C# Document.Object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.Object方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getDocumentText
private string getDocumentText(Document document)
{
if (document == null) return null;
var textDocument = (TextDocument)document.Object("TextDocument");
EditPoint editPoint = textDocument.StartPoint.CreateEditPoint();
var content = editPoint.GetText(textDocument.EndPoint);
return content;
}
示例2: GetTextDocument
private TextDocument GetTextDocument(Document doc) {
if (doc == null || doc.ReadOnly) {
return null;
}
var textDoc = doc.Object("TextDocument") as TextDocument;
return textDoc;
}
示例3: DocumentReader
public DocumentReader(Document document)
{
this.document = document;
TextDocument textDocument = (TextDocument)document.Object("TextDocument");
EditPoint editPoint = textDocument.StartPoint.CreateEditPoint();
editPoint.StartOfDocument();
strDocument = editPoint.GetText(textDocument.EndPoint);
documentIndex = -1;
SetTabSize();
}
示例4: InsertTemplate
private void InsertTemplate(Document document, string toInsert)
{
var textDocument = document.Object() as TextDocument;
textDocument.StartPoint.CreateEditPoint();
textDocument.Selection.Insert(toInsert);
}
示例5: SelectAllCodeFromDocument
//Nice clean methods avoiding slow selection-editing, from online post at:
// http://www.visualstudiodev.com/visual-studio-extensibility/how-can-i-edit-documents-programatically-22319.shtml
private static string SelectAllCodeFromDocument(Document targetDoc)
{
string outText = "";
TextDocument textDoc = targetDoc.Object("TextDocument") as TextDocument;
if (textDoc != null)
outText = textDoc.StartPoint.CreateEditPoint().GetText(textDoc.EndPoint);
return outText;
}
示例6: ReplaceAllCodeInDocument
private static void ReplaceAllCodeInDocument(Document targetDoc, string newText)
{
TextDocument textDoc = targetDoc.Object("TextDocument") as TextDocument;
if (textDoc != null)
{
textDoc.StartPoint.CreateEditPoint().Delete(textDoc.EndPoint);
textDoc.StartPoint.CreateEditPoint().Insert(newText);
}
}
示例7: ReplaceAllCodeInDocument
private static void ReplaceAllCodeInDocument(Document targetDoc, string newText)
{
TextDocument textDoc = targetDoc.Object("TextDocument") as TextDocument;
if (textDoc != null)
{
textDoc.StartPoint.CreateEditPoint().ReplaceText(textDoc.EndPoint, newText, (int)vsEPReplaceTextOptions.vsEPReplaceTextKeepMarkers);
}
}
示例8: GetTextDocument
public static TextDocument GetTextDocument(Document doc)
{
return doc.Object("TextDocument") as TextDocument;
}