May not be the easiest way, but this works;
Create a document template that includes the section numbering set up the way you want it, using heading styles. Load the document, and use that as the starting point. When you add text, set the stylename to the appropriate style, and the numbering should
be generated automatically. The correct stylename settings are "Heading1", "Heading2" and "Heading3". Here's the basic approach;
dim p1 as newdoc.insertparagraph
p1.stylename = "Heading1"
p1.append "This is level 1"
dim p2 as newdoc.insertparagraph
p2.stylename = "Heading2"
p2.append "This is level 1.1"