Onetastic Macro Documentation >
>
Creating new page content Creating new page content
With macros you can create new pages and new content on pages in OneNote. The
InsertObject function allows creating new pages, outlines, paragraphs and tables.
Creating new pages
To create a new page, you need to insert a new Page object to a Section object.
You can specify where in the section you want to create the new page:
InsertObject(GetCurrentSection(), "Page", 0)
InsertObject(GetCurrentSection(), "Page", -1)
InsertObject(GetCurrentSection(), "Page", 3)
Creating new page content
You can create new page content in an existing page or a newly created page.
Simply add more InsertObject functions to create the new objects. After creating each
object, you can modify its properties or create more content below it:
$Page = GetCurrentPage()
$Outline = InsertObject($Page, "Outline", -1)
$Paragraph = InsertObject($Outline, "Paragraph", 0)
$Paragraph.text = "Below is a table"
$Table = InsertObject($Outline, "Table", -1)
$Row = InsertObject($Table, "Row", -1)
$Cell = InsertObject($Row, "Cell", -1)
$Paragraph = InsertObject($Cell, "Paragraph", -1)
$Text = InsertObject($Paragraph, "Text", -1)
$Text.value = "First"
$Text.bold = true
InsertObject($Paragraph, "Text", -1).value = " cell"
InsertObject($Row, "Cell", -1).text = "A second cell"
|