Onetastic Macro Documentation >
>
>
CopyObject CopyObject
Creates a copy of a given object and inserts it into OneNote hierarchy or into a OneNote page. Returns the newly created object. Following types of objects can be copied: Section Page Outline Table Row Cell Paragraph Text Image EmbeddedFile Tag. If a password protected section is copied while it is locked, its pages won't be copied. If it is copied while it is unlocked, the pages will be copied but the newly created section will not be password protected.
Syntax
Object CopyObject(
Object parent,
Object object,
Numeric position)
Parameters
- Object parent
- Parent object to create the new object under. The type of the source object must be one of the types that can be inserted under the parent object. See remarks for compatible types.
- Object object
- Object to copy from. A new object of the same type will be created and all the properties and any descendant objects will be copied over.
- Numeric position
- The position of the new object. The value is a 0 based index for the child collection or -1 to insert at the end.
RemarksFollowing types of objects can be created, copied, and moved via InsertObject, CopyObject,
and MoveObject functions. See descriptions of each function for specific conditions or differences in behavior:
Parent Object |
Child Object Types |
Remarks |
Notebook |
SectionGroup Section |
Sections and section groups must have unique names inside a notebook. Section groups
cannot be copied or moved. Sections cannot be moved. |
SectionGroup |
SectionGroup Section |
Sections and section groups must have unique names inside a section group. Section groups
cannot be copied, moved, or removed. Sections cannot be moved or removed. |
Section |
Page |
|
Page |
Outline Image EmbeddedFile |
To create a Title object under a page, simply access its "title" property. |
Outline |
Paragraph Table Image EmbeddedFile |
An outline must have at least one child object. |
Paragraph |
Text Tag |
Text objects can only be inserted at the beginning or end of a paragraph. Text objects cannot be moved or removed |
Table |
Row |
A table must have at least one row. |
Row |
Cell |
A row must have at least one cell. Every row in a table must have the same number of cells. |
Cell |
Paragraph Table Image EmbeddedFile |
A cell must have at least one child object. |
Image |
Tag |
Image must be a direct child of a page to insert tags. Images inside outlines cannot have tags. Insert the tag into the image's parent paragraph instead. |
EmbeddedFile |
Tag |
Embedded file must be a direct child of a page to insert tags. Embedded files inside outlines cannot have tags. Insert the tag into the embedded file's parent paragraph instead. |
|