本文整理汇总了C#中Field.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Field.Select方法的具体用法?C# Field.Select怎么用?C# Field.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillInField
private void FillInField(Field field, Application wordApp)
{
var fieldText = field.Code.Text;
if (!fieldText.StartsWith(" MERGEFIELD")) return;
var match = Regex.Match(fieldText, @"(?<=MERGEFIELD).[^\\]*", RegexOptions.IgnoreCase);
if (!match.Success) return;
var fieldName = match.Value.Trim();
foreach (var parameters in _label.ParameterArray)
{
if (fieldName.ToLower() != parameters.ToLower()) continue;
field.Select();
wordApp.Selection.TypeText(_label.ParameterValue(parameters));
}
}
示例2: NewObject
public static Field NewObject(IRequest context, Field typeName, Field[] args = null)
{
if (Field.IsNullField(typeName))
throw new ArgumentNullException("typeName");
if (!(typeName.Type is StringType))
throw new ArgumentException("The type name argument must be of string type.");
var argExp = new SqlExpression[args == null ? 0 : args.Length];
if (args != null) {
argExp = args.Select(SqlExpression.Constant).Cast<SqlExpression>().ToArray();
}
var type = context.Access().ResolveUserType(typeName.Value.ToString());
if (type == null)
throw new InvalidOperationException(String.Format("The type '{0}' was not defined.", typeName));
if (!(type is UserType))
throw new InvalidOperationException(String.Format("The type '{0}' is not a user-defined type", typeName));
var userType = (UserType) type;
var obj = userType.NewObject(context, argExp);
return Field.Object(userType, obj);
}
示例3: updateField
private static void updateField(Field field, Microsoft.Office.Interop.Word.Application word, String filename)
{
switch (field.Type)
{
case WdFieldType.wdFieldAuthor:
case WdFieldType.wdFieldAutoText:
case WdFieldType.wdFieldComments:
case WdFieldType.wdFieldCreateDate:
case WdFieldType.wdFieldDate:
case WdFieldType.wdFieldDocProperty:
case WdFieldType.wdFieldDocVariable:
case WdFieldType.wdFieldEditTime:
case WdFieldType.wdFieldFileSize:
case WdFieldType.wdFieldFootnoteRef:
case WdFieldType.wdFieldGreetingLine:
case WdFieldType.wdFieldIndex:
case WdFieldType.wdFieldInfo:
case WdFieldType.wdFieldKeyWord:
case WdFieldType.wdFieldLastSavedBy:
case WdFieldType.wdFieldNoteRef:
case WdFieldType.wdFieldNumChars:
case WdFieldType.wdFieldNumPages:
case WdFieldType.wdFieldNumWords:
case WdFieldType.wdFieldPage:
case WdFieldType.wdFieldPageRef:
case WdFieldType.wdFieldPrintDate:
case WdFieldType.wdFieldRef:
case WdFieldType.wdFieldRevisionNum:
case WdFieldType.wdFieldSaveDate:
case WdFieldType.wdFieldSection:
case WdFieldType.wdFieldSectionPages:
case WdFieldType.wdFieldSubject:
case WdFieldType.wdFieldTime:
case WdFieldType.wdFieldTitle:
case WdFieldType.wdFieldTOA:
case WdFieldType.wdFieldTOAEntry:
case WdFieldType.wdFieldTOC:
case WdFieldType.wdFieldTOCEntry:
case WdFieldType.wdFieldUserAddress:
case WdFieldType.wdFieldUserInitials:
case WdFieldType.wdFieldUserName:
field.Update();
break;
case WdFieldType.wdFieldFileName:
// Handle the filename as a special situation, since it doesn't seem to
// update correctly (issue #13)
field.Select();
field.Delete();
Selection selection = word.Selection;
selection.TypeText(Path.GetFileName(filename));
Converter.releaseCOMObject(selection);
break;
}
}