'==============================================================
'    txt-  docx- ()
'==============================================================

'  
Dim iLineNumber         '  
Dim TextFileName        '   txt- 
Dim WordFileName        '   docx-
Dim Selection

'--------------------------------------------------------------
Const ForReading = 1
Const wdOrientLandscape = 1
Const wdLineStyleSingle = 1

'Table border constants
Const wdBorderTop          = -1
Const wdBorderLeft         = -2
Const wdBorderBottom       = -3
Const wdBorderRight        = -4
Const wdBorderHorizontal   = -5
Const wdBorderVertical     = -6
Const wdBorderDiagonalDown = -7
Const wdBorderDiagonalUp   = -8 


Set objFSO = CreateObject("Scripting.FileSystemObject")

'   
CurrentFolderName = objFSO.GetParentFolderName(WScript.ScriptFullName)

'    
TextFileName = CurrentFolderName & "\Rus-Eng.txt"
'   doc-
WordFileName = CurrentFolderName & "\docs\NAME.docx"

'--------------------------------------------------------------
'     doc-
Set objWord = CreateObject("Word.Application")

Set objDoc = objWord.Documents.Add()

objWord.Visible = True

'    
' objDoc.PageSetup.Orientation = wdOrientLandscape

'   
objDoc.AutoHyphenation = True

Set objRange = objDoc.Range()

'------------------------------------------------
'    - 3
objDoc.Tables.Add objRange,1,3
Set objTable = objDoc.Tables(1)

'    - 10
objTable.Range.Font.Size = 12

'    - "Arial"
objTable.Range.Font.Name = "Times New Roman"

'------------------------------------------------
'     
Set objTextFile = objFSO.OpenTextFile (TextFileName, ForReading)

x=1

'------------------------------------------------
'      doc

Do Until objTextFile.AtEndOfStream

    If x > 1 Then
        objTable.Rows.Add()
    End If

    objTable.Cell(x, 1).Column.Width = 30
    objTable.Cell(x, 2).Column.Width = 210
    objTable.Cell(x, 3).Column.Width = 200

    strNextLine = objTextFile.Readline
    objTable.Cell(x, 1).Range.Text = strNextLine

    strNextLine = objTextFile.Readline
    objTable.Cell(x, 2).Range.text = strNextLine

    strNextLine = objTextFile.Readline
    objTable.Cell(x, 3).Range.text = strNextLine

    x = x + 1
Loop

' -------------------------------------------------------------
'    

objWord.Selection.InsertRowsAbove

objTable.PreferredWidth = 440

'objTable.AutoFormat(16)

objTable.Cell(1, 1).Range.InsertAfter(" /")
objTable.Cell(1, 1).Range.Bold = True
objTable.Cell(1, 1).Range.ParagraphFormat.Alignment = 1

objTable.Cell(1, 2).Range.InsertAfter("  ")
objTable.Cell(1, 2).Range.Bold = True
objTable.Cell(1, 2).Range.ParagraphFormat.Alignment = 1

objTable.Cell(1, 3).Range.InsertAfter("  ")
objTable.Cell(1, 3).Range.Bold = True
objTable.Cell(1, 3).Range.ParagraphFormat.Alignment = 1

objTable.AutoFormat(16)

objTable.Cell(1, 1).Range.InsertAfter("")
objTable.Cell(1, 1).Range.Bold = True
objTable.Cell(1, 1).Range.ParagraphFormat.Alignment = 1

objTable.Cell(1, 2).Range.InsertAfter("")
objTable.Cell(1, 2).Range.Bold = True
objTable.Cell(1, 2).Range.ParagraphFormat.Alignment = 1

objTable.Cell(1, 3).Range.InsertAfter("")
objTable.Cell(1, 3).Range.Bold = True
objTable.Cell(1, 3).Range.ParagraphFormat.Alignment = 1

' -------------------------------------------------------------
objDoc.SaveAs(WordFileName)

objWord.Quit
