• 15 апреля стартует «Курс «SQL-injection Master» ©» от команды The Codeby

    За 3 месяца вы пройдете путь от начальных навыков работы с SQL-запросами к базам данных до продвинутых техник. Научитесь находить уязвимости связанные с базами данных, и внедрять произвольный SQL-код в уязвимые приложения.

    На последнюю неделю приходится экзамен, где нужно будет показать свои навыки, взломав ряд уязвимых учебных сайтов, и добыть флаги. Успешно сдавшие экзамен получат сертификат.

    Запись на курс до 25 апреля. Получить промодоступ ...

Как добавить таблицу в Word документ из встроенной вьюшки

  • Автор темы Sandro
  • Дата начала
S

Sandro

Встала такая проблемка , нужно сформировать вордовский документ с заполняемыми полями и сформировать табличку из встроенного в форму представления, как заполнить поля понятно, как импортировать в эксель тоже, а вот как совладать с вордовской таблицей не пойму. Если есть подобный пример буду очень благодарен, а то сроки уже поджимают ((((

<table valign="top" style='margin:0;width:100%;border:1px dashed red;'>[tr]<td align='middle' bgcolor='#ff6060' valign='top' width='1%'>
<FONT color='#ffffff' size='+3'> ! </font>
</td><td align="midle" valign='top' style='background:#fff;'>А при чем здесь Lotus вообще? Изучайте VBA Word. Перемещено.</td>[/tr]</table>
 
K

Klido

Table Object
Represents a single table. The Table object is a member of the Tables collection. The Tables collection includes all the tables in the specified selection, range, or document.
Remarks


Use Tables(Index), where Index is the index number, to return a single Table object. The index number represents the position of the table in the selection, range, or document. The following example converts the first table in the active document to text.

ActiveDocument.Tables(1).ConvertToText Separator:=wdSeparateByTabs

Use the Add method to add a table at the specified range. The following example adds a 3x4 table at the beginning of the active document.

Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Tables.Add Range:=myRange, NumRows:=3, NumColumns:=4
 
S

Sandro

Table Object
Represents a single table. The Table object is a member of the Tables collection. The Tables collection includes all the tables in the specified selection, range, or document.
Remarks


Use Tables(Index), where Index is the index number, to return a single Table object. The index number represents the position of the table in the selection, range, or document. The following example converts the first table in the active document to text.

ActiveDocument.Tables(1).ConvertToText Separator:=wdSeparateByTabs

Use the Add method to add a table at the specified range. The following example adds a 3x4 table at the beginning of the active document.

Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Tables.Add Range:=myRange, NumRows:=3, NumColumns:=4
Спасиб, понял
 
H

hosm

Похоже, это неочевидно:
Если обращаемся к таблице не напрямую из VBA Word, используется такой синтаксис
Код:
Set myRange = Application.ActiveDocument.Range(0, 0)
Application.ActiveDocument.Tables.Add(myRange, 3, 4)
Правильный порядок параметров смотрим в справке VBA.
(Константы нужные - в окне просмотра переменных, например)
 
Мы в соцсетях:

Обучение наступательной кибербезопасности в игровой форме. Начать игру!