C# Class OneNoteConversionTool.OutputGenerator.OneNoteGenerator

Handles the interaction with the OneNote document output, including creating notebook, section, page, adding content, and other things
显示文件 Open project: OneNoteDev/OneNoteConversionTool Class Usage Examples

Public Methods

Method Description
AddImageToPage ( string pageId, Image img, int yPos = 80 ) : void

Adds an image to the page The width of the page is at most MaxPageWidth (960 pixels) If the width is bigger, the image is proportionally minimized to MaxPageWidth

AddPageContent ( string pageId, string content, int yPos = 80, int width = 520 ) : void

Adds the content to the corresponding page.

AddPageContentAsHtmlBlock ( string pageId, string content, int yPos = 80, int width = 520 ) : void

Adds the content as a HTML block.

AppendImageToPage ( string pageId, Image img ) : void

Adds the image at the end of the corresponding page

AppendPageContent ( string pageId, string content, int width = 520 ) : void

Adds the content at the end of the corresponding page.

AppendPageContentAsHtmlBlock ( string pageId, string content, int width = 520 ) : void

Adds the content as HTML block at the end of the corresponding page

CreateNotebook ( string notebookName ) : string

Creates a new OneNote notebook with the given name

CreatePage ( string pageName, string sectionId ) : string

Creates a one note page under the given section ID

CreateSection ( string sectionName, string notebookId ) : string

Creates one note section under the given notebook ID

CreateTableOfContentPage ( string sectionId, string tocPageTitle = "Table of Contents" ) : string

Generates a Table of Content Page of all the pages underneath the given section Also sets the Table of Content Page to be the first page in the given section

GetChildrenScopeHierarchy ( string objectId ) : string

Returns the children scope hierarchy of the OneNote object in XML format Gets the immediate child nodes of the start node, and no descendants in higher or lower subsection groups.

GetHyperLinkToObject ( string objectId ) : string

get the hyper link to the object

GetNotebook ( string notebookName ) : string

Gets the ID of an existing notebook in the current directory

GetPage ( string pageName, string sectionId ) : string

Gets the ID o fan existing page in the given section If more than one exists, it returns the first one

GetPageAttribute ( string pageId, string attr ) : string

Gets the value of an attribute of the page

GetPageContent ( string pageId ) : XmlDocument

GetPageContent return DOM representation of onenote's page

GetPageHeight ( string pageId ) : double

Get the height of the page

GetPageScopeHierarchy ( string objectId ) : string

Returns the page scope hierarchy of the onenote object(page\section\notebook) in XML format Gets all pages below the start node, including all pages in section groups and subsection groups.

GetPageWidth ( string pageId ) : double

Get the height of the page

GetSection ( string sectionName, string notebookId ) : string

Gets the ID of an existing section in the given notebook If more than one exists, it returns the first one

GetSectionScopeHierarchy ( string objectId ) : string

Returns the section scope hierarchy of the onenote object(section\notebook) in XML format Gets all sections below the start node, including sections in section groups and subsection groups.

OneNoteGenerator ( string mOutputDir ) : System

Constructor

RemoveAuthor ( string pageId ) : void

Removes the author from any node in the page

SetAsFirstPage ( string pageId, string sectionId ) : void

set a page as the first page in the section

SetCollapsePage ( string pageId, bool isCollapsed = true ) : void

Sets the collapse attribute of the page to hide or unhide the subpages under the given page

SetPageAttribute ( string pageId, string attr, string value ) : void

Sets the page attribute to the given value

SetPageLevel ( string pageId, int pageLevel ) : void

Sets the page level of a given page (note, page level must be {1, 2, or 3})

SetPageTitleAttribute ( string pageId, string attr, string value ) : void

Sets the page title attribute to the given value

SetShowDate ( string pageId, bool isShown = true ) : void

Sets whether the date should be shown or not in the page

SetShowTime ( string pageId, bool isShown = true ) : void

Sets whether the time should be shown or not in the page

SetSubPage ( string sectionId, string pageId, bool isSet = true ) : void

Make the page as subpage (if isSet true) or promote it (if isSet if false)

UpdatePageContent ( string pageId, string content ) : void

UpdatePageContent this method is invoked when a previous page word section needs to be updated

Private Methods

Method Description
GetNSManager ( XmlNameTable nameTable ) : XmlNamespaceManager

Returns the namespace manager from the passed xml name table.

Method Details

AddImageToPage() public method

Adds an image to the page The width of the page is at most MaxPageWidth (960 pixels) If the width is bigger, the image is proportionally minimized to MaxPageWidth
public AddImageToPage ( string pageId, Image img, int yPos = 80 ) : void
pageId string
img Image
yPos int
return void

AddPageContent() public method

Adds the content to the corresponding page.
public AddPageContent ( string pageId, string content, int yPos = 80, int width = 520 ) : void
pageId string Page Identifier in which the content to be displayed.
content string The content which needs to be added to the page.
yPos int Starting vertical position of the block in the page in Pixels from the top of the page
width int Maximum width of the outline block where the content is added
return void

AddPageContentAsHtmlBlock() public method

Adds the content as a HTML block.
public AddPageContentAsHtmlBlock ( string pageId, string content, int yPos = 80, int width = 520 ) : void
pageId string Id of the page
content string content to be added
yPos int Starting position of the block
width int Width of the block
return void

AppendImageToPage() public method

Adds the image at the end of the corresponding page
public AppendImageToPage ( string pageId, Image img ) : void
pageId string ID of the page
img Image The Image to be added
return void

AppendPageContent() public method

Adds the content at the end of the corresponding page.
public AppendPageContent ( string pageId, string content, int width = 520 ) : void
pageId string Id of the page
content string content to be added
width int Width of the block
return void

AppendPageContentAsHtmlBlock() public method

Adds the content as HTML block at the end of the corresponding page
public AppendPageContentAsHtmlBlock ( string pageId, string content, int width = 520 ) : void
pageId string ID of the page
content string HTML block to be added
width int Width of the block
return void

CreateNotebook() public method

Creates a new OneNote notebook with the given name
public CreateNotebook ( string notebookName ) : string
notebookName string
return string

CreatePage() public method

Creates a one note page under the given section ID
public CreatePage ( string pageName, string sectionId ) : string
pageName string
sectionId string
return string

CreateSection() public method

Creates one note section under the given notebook ID
public CreateSection ( string sectionName, string notebookId ) : string
sectionName string
notebookId string
return string

CreateTableOfContentPage() public method

Generates a Table of Content Page of all the pages underneath the given section Also sets the Table of Content Page to be the first page in the given section
public CreateTableOfContentPage ( string sectionId, string tocPageTitle = "Table of Contents" ) : string
sectionId string
tocPageTitle string
return string

GetChildrenScopeHierarchy() public method

Returns the children scope hierarchy of the OneNote object in XML format Gets the immediate child nodes of the start node, and no descendants in higher or lower subsection groups.
public GetChildrenScopeHierarchy ( string objectId ) : string
objectId string
return string

GetHyperLinkToObject() public method

get the hyper link to the object
public GetHyperLinkToObject ( string objectId ) : string
objectId string
return string

GetNotebook() public method

Gets the ID of an existing notebook in the current directory
public GetNotebook ( string notebookName ) : string
notebookName string name of the notebook of interest
return string

GetPage() public method

Gets the ID o fan existing page in the given section If more than one exists, it returns the first one
public GetPage ( string pageName, string sectionId ) : string
pageName string page name
sectionId string ID of the section where the page exists
return string

GetPageAttribute() public method

Gets the value of an attribute of the page
public GetPageAttribute ( string pageId, string attr ) : string
pageId string ID of the page
attr string the attribute of interest
return string

GetPageContent() public method

GetPageContent return DOM representation of onenote's page
public GetPageContent ( string pageId ) : XmlDocument
pageId string
return System.Xml.XmlDocument

GetPageHeight() public method

Get the height of the page
public GetPageHeight ( string pageId ) : double
pageId string id of the page
return double

GetPageScopeHierarchy() public method

Returns the page scope hierarchy of the onenote object(page\section\notebook) in XML format Gets all pages below the start node, including all pages in section groups and subsection groups.
public GetPageScopeHierarchy ( string objectId ) : string
objectId string
return string

GetPageWidth() public method

Get the height of the page
public GetPageWidth ( string pageId ) : double
pageId string id of the page
return double

GetSection() public method

Gets the ID of an existing section in the given notebook If more than one exists, it returns the first one
public GetSection ( string sectionName, string notebookId ) : string
sectionName string section name
notebookId string ID of the notebook where the section exists
return string

GetSectionScopeHierarchy() public method

Returns the section scope hierarchy of the onenote object(section\notebook) in XML format Gets all sections below the start node, including sections in section groups and subsection groups.
public GetSectionScopeHierarchy ( string objectId ) : string
objectId string
return string

OneNoteGenerator() public method

Constructor
public OneNoteGenerator ( string mOutputDir ) : System
mOutputDir string
return System

RemoveAuthor() public method

Removes the author from any node in the page
public RemoveAuthor ( string pageId ) : void
pageId string
return void

SetAsFirstPage() public method

set a page as the first page in the section
public SetAsFirstPage ( string pageId, string sectionId ) : void
pageId string
sectionId string
return void

SetCollapsePage() public method

Sets the collapse attribute of the page to hide or unhide the subpages under the given page
public SetCollapsePage ( string pageId, bool isCollapsed = true ) : void
pageId string ID of the page
isCollapsed bool isCollapsed attribute value
return void

SetPageAttribute() public method

Sets the page attribute to the given value
public SetPageAttribute ( string pageId, string attr, string value ) : void
pageId string ID of the page
attr string The attribute of interest
value string The new value of the attribute
return void

SetPageLevel() public method

Sets the page level of a given page (note, page level must be {1, 2, or 3})
public SetPageLevel ( string pageId, int pageLevel ) : void
pageId string
pageLevel int
return void

SetPageTitleAttribute() public method

Sets the page title attribute to the given value
public SetPageTitleAttribute ( string pageId, string attr, string value ) : void
pageId string ID of the page
attr string The attribute of interest for one:Title node
value string The new value of the attribute
return void

SetShowDate() public method

Sets whether the date should be shown or not in the page
public SetShowDate ( string pageId, bool isShown = true ) : void
pageId string
isShown bool
return void

SetShowTime() public method

Sets whether the time should be shown or not in the page
public SetShowTime ( string pageId, bool isShown = true ) : void
pageId string
isShown bool
return void

SetSubPage() public method

Make the page as subpage (if isSet true) or promote it (if isSet if false)
public SetSubPage ( string sectionId, string pageId, bool isSet = true ) : void
sectionId string
pageId string
isSet bool defaults to true, if true, increment pageLevel, else decrement pageLevel
return void

UpdatePageContent() public method

UpdatePageContent this method is invoked when a previous page word section needs to be updated
public UpdatePageContent ( string pageId, string content ) : void
pageId string
content string
return void