Sub CreateTable()
Dim app As nanoCAD.Application, CurDoc As nanoCAD.Document
Dim i&, InsPt#(), kl#, st#
Set app = GetObject("", "nanoCAD.Application")
app.Visible = True
Set CurDoc = app.ActiveDocument
InsPt = CurDoc.Utility.GetPoint("0,0,0", "Укажите точку вставки объекта")
Randomize
With CurDoc.ModelSpace.AddTable(InsPt, 6, 5, 8, 20)
.SetColumnWidth 0, 10
.SetColumnWidth 1, 50
.SetColumnWidth 2, 15
.SetColumnWidth 3, 25
.SetColumnWidth 3, 25
.SetText 0, 0, "Табличка"
For i = 1 To 5
.SetText i, 0, i & "."
.SetText i, 1, "Товар " & Format(i, "00")
kl = i * 10
.SetText i, 2, CStr(kl)
st = 100 * i * Int((6 * Rnd) + 1) / 12.44
.SetText i, 3, Format$(st, "0.00")
.SetText i, 4, Format$(kl * st, "0.00")
.SetCellAlignment i, 1, acMiddleLeft
Next i
End With
End Sub
|