AXForum  
Вернуться   AXForum > Microsoft Dynamics NAV > NAV: Программирование
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 13.09.2006, 10:43   #3  
InTacto is offline
InTacto
Участник
Аватар для InTacto
 
323 / 11 (1) +
Регистрация: 09.08.2005
Вот! Это справка по FormFields из Ворда!

Use FormFields(index), where index is a bookmark name or index number, to return a single FormField object. The following example sets the result of the Text1 form field to "Don Funk."

ActiveDocument.FormFields("Text1").Result = "Don Funk"

The index number represents the position of the form field in the selection, range, or document. The following example displays the name of the first form field in the selection.

If Selection.FormFields.Count >= 1 Then
MsgBox Selection.FormFields(1).Name
End If

Use the Add method with the FormFields object to add a form field. The following example adds a check box at the beginning of the active document and then selects the check box.

Set ffield = ActiveDocument.FormFields.Add( _
Range:=ActiveDocument.Range(Start:=0, End:=0), _
Type:=wdFieldFormCheckBox)
ffield.CheckBox.Value = True

Remarks
Use the CheckBox, DropDown, and TextInput properties with the FormField object to return the CheckDown, DropDown, and TextInput objects. The following example selects the check box named "Check1."

ActiveDocument.FormFields("Check1").CheckBox.Value = True

А вот что у меня получилось:


// Создание ОБъекта
IF ISCLEAR(WordApp) THEN
CREATE(WordApp);

// Путь к шаблону ( Здесь под шаблоном понимается, не шаблон Ворда, который используется в Мerge, а шаблон как обычный файл док для заполнения)
FileName:='C:\TEst.doc';

// ОТкурытие файла шаблона
WrdDoc := WordApp.Documents.Open2000(FileName);
WrdDoc.Activate;

//WrdDoc.FormFields.count;

// ОБъявление переменной для задания значения
WordFieldsLoc:=WrdDoc.Fields;


FOR j:=1 TO WrdDoc.FormFields.Count DO
BEGIN
//объявление переменной для получения имени
WordApp.ActiveDocument.Fields.Item(j).Select;
WordApp.Selection ;
FieldName:=WrdSelect.FormFields.Item(j).Name;
// далее следует заполение полей по их именам
end;

Этот пример работает, если в документе одни FormFields.
Как только появляется другой текст, то этот алгоритм не может , как я понял, правильно идти
по Selection, т.к. ему нужно указывать начало и конец параграфа и идти по объектам этого Selection.

Если что-то не понятно, могу обсказать.
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 13:39.