-Подписка по e-mail

 

 -Поиск по дневнику

Поиск сообщений в community_coding

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 29.12.2004
Записей:
Комментариев:
Написано: 536


Вопрос к программистам по СОМ

Вторник, 04 Декабря 2007 г. 15:20 + в цитатник
Ефр все записи автора Есть документ Word. В нем есть поля форм. Документ закрыт так, что текст можно вводить толкьо в поля. Программно могу добраться до документа. А вот как писать свой текст в поля - не знаю.
КомОбъект.FormFields есть.
Но по индексу значения не получить:
КомОбъект.FormFields[1] {(1)}: Получение элемента по индексу для значения не
определено

КомОбъект.FormFields["Pole2"] {(1)}: Поле объекта не обнаружено (Pole2)

КомОбъект.FormFields.Pole2 {(1)}: Поле объекта не обнаружено (Pole2)

Вложение: 3632500_Primer.doc

Рубрики:  вопросы

T100-ZaRaZa   обратиться по имени Вторник, 04 Декабря 2007 г. 15:30 (ссылка)
Берешь, читаешь хелп к VB for Application. COM тут непричем )

Word Developer Reference

FormFields.Item Method
Returns an individual FormField object in a collection.

Syntax:

expression.Item(Index)

expression Required. A variable that represents a FormFields collection.
Ответить С цитатой В цитатник
Ефр   обратиться по имени Вторник, 04 Декабря 2007 г. 15:54 (ссылка)
Using the FormField Object

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
Ответить С цитатой В цитатник
 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку