C# Class OneNoteConversionTool.FormatConversion.GenericFormatConverter

Handles the generic file format conversion into OneNote
Inheritance: IFormatConverter
Show file Open project: OneNoteDev/OneNoteConversionTool Class Usage Examples

Public Methods

Method Description
ConvertEpubToOneNote ( string inputFile, string outputDir ) : bool

Converts the ePub document input file into OneNote

ConvertInDesignToOneNote ( string inputFile, string outputDir ) : bool

Converts the InDesign document input file into OneNote

ConvertPdfToOneNote ( string inputFile, string outputDir ) : bool

Converts PDF file to OneNote by including an image for each page in the document

ConvertPowerPointToOneNote ( string inputFile, string outputDir ) : bool

Converts PowerPoint presentation into OneNote section

ConvertWordToOneNote ( string inputFile, string outputDir ) : bool

Converts the Word document input file into OneNote

GetSupportedInputFormat ( ) : string

Returns the name of the input format that this IFormatConverter supports

Protected Methods

Method Description
ConvertHtmlToOneNote ( string inputFile, string originalPicFolder, string auxPicFolder, OneNoteGenerator onGenerator, string sectionId ) : bool

Converts Html file into OneNote Section of Pages

ConvertPowerPointToImages ( string inputFile, string outputDir ) : string

Converts PowerPoint presentation to images where is slide is given by one image

ConvertPowerPointToOneNote ( PowerPointOpenXml pptOpenXml, string imgsPath, OneNoteGenerator note, string sectionName ) : void

Converts PowerPoint presentan to OneNote while converting the sections in power point to main pages, and slides to sub pages

CreateErrorPage ( OneNoteGenerator onGenerator, string sectionId, string>.IEnumerable errorList ) : void

Create the error page for the section, which contains all the errors occurred during the conversion

GeneratePageContent ( HtmlNode htmlBox, IEnumerable page, string originalPicFolderPath, string auxPicFolderPath, string>.IDictionary errorInfo ) : string

Generate Html page content from List of HtmlNode

GetInDesignTitle ( HtmlAgilityPack.HtmlDocument htmlDoc ) : string

Get the title and remove its elements from the document

GetPageTitle ( IEnumerable pageNodes ) : string

Grabs the page node to be used as title and remove it from the pageNodes

InsertPowerPointSlideInOneNote ( int slideNumber, PowerPointOpenXml pptOpenXml, string imgsPath, OneNoteGenerator note, string sectionId, bool showComments = true, string commentsStr = "Comments", bool showNotes = true, string notesStr = "Notes", bool hiddenSlideNotIncluded = true ) : string

Inserts a power point slide into a given section in OneNote as a page

ModifyInDesignHtmlLinks ( HtmlAgilityPack.HtmlDocument htmlDoc, string htmlDir ) : void

change the links to have the full path

SeparatePages ( HtmlNode content ) : IEnumerable>

Splits HtmlNodes into List of HtmlNodes based on page breaks

SetInDesignHtmlExportOptions ( InDesign.Document doc ) : void

Sets the export options of the indesign document to HTML

Private Methods

Method Description
GetErrorImagePath ( string picFolderPath ) : string

a big error image to indicate user where had failed to import an image

ReplaceEpubLinksFromHtmlToOneNote ( List pagesHtml, List pagePaths, List pageLinks ) : void

Replace the url links in the epub Html pages to links for the OneNote Pages

Method Details

ConvertEpubToOneNote() public method

Converts the ePub document input file into OneNote
public ConvertEpubToOneNote ( string inputFile, string outputDir ) : bool
inputFile string
outputDir string
return bool

ConvertHtmlToOneNote() protected method

Converts Html file into OneNote Section of Pages
protected ConvertHtmlToOneNote ( string inputFile, string originalPicFolder, string auxPicFolder, OneNoteGenerator onGenerator, string sectionId ) : bool
inputFile string
originalPicFolder string
auxPicFolder string
onGenerator OneNoteConversionTool.OutputGenerator.OneNoteGenerator
sectionId string
return bool

ConvertInDesignToOneNote() public method

Converts the InDesign document input file into OneNote
public ConvertInDesignToOneNote ( string inputFile, string outputDir ) : bool
inputFile string
outputDir string
return bool

ConvertPdfToOneNote() public method

Converts PDF file to OneNote by including an image for each page in the document
public ConvertPdfToOneNote ( string inputFile, string outputDir ) : bool
inputFile string PDF document path
outputDir string Directory of the output OneNote Notebook
return bool

ConvertPowerPointToImages() protected method

Converts PowerPoint presentation to images where is slide is given by one image
protected ConvertPowerPointToImages ( string inputFile, string outputDir ) : string
inputFile string
outputDir string
return string

ConvertPowerPointToOneNote() public method

Converts PowerPoint presentation into OneNote section
public ConvertPowerPointToOneNote ( string inputFile, string outputDir ) : bool
inputFile string
outputDir string
return bool

ConvertPowerPointToOneNote() protected method

Converts PowerPoint presentan to OneNote while converting the sections in power point to main pages, and slides to sub pages
protected ConvertPowerPointToOneNote ( PowerPointOpenXml pptOpenXml, string imgsPath, OneNoteGenerator note, string sectionName ) : void
pptOpenXml OneNoteConversionTool.FormatReaders.PowerPointOpenXml
imgsPath string
note OneNoteConversionTool.OutputGenerator.OneNoteGenerator
sectionName string
return void

ConvertWordToOneNote() public method

Converts the Word document input file into OneNote
public ConvertWordToOneNote ( string inputFile, string outputDir ) : bool
inputFile string
outputDir string
return bool

CreateErrorPage() protected method

Create the error page for the section, which contains all the errors occurred during the conversion
protected CreateErrorPage ( OneNoteGenerator onGenerator, string sectionId, string>.IEnumerable errorList ) : void
onGenerator OneNoteConversionTool.OutputGenerator.OneNoteGenerator
sectionId string
errorList string>.IEnumerable
return void

GeneratePageContent() protected method

Generate Html page content from List of HtmlNode
protected GeneratePageContent ( HtmlNode htmlBox, IEnumerable page, string originalPicFolderPath, string auxPicFolderPath, string>.IDictionary errorInfo ) : string
htmlBox HtmlAgilityPack.HtmlNode
page IEnumerable
originalPicFolderPath string
auxPicFolderPath string
errorInfo string>.IDictionary
return string

GetInDesignTitle() protected method

Get the title and remove its elements from the document
protected GetInDesignTitle ( HtmlAgilityPack.HtmlDocument htmlDoc ) : string
htmlDoc HtmlAgilityPack.HtmlDocument
return string

GetPageTitle() protected method

Grabs the page node to be used as title and remove it from the pageNodes
protected GetPageTitle ( IEnumerable pageNodes ) : string
pageNodes IEnumerable
return string

GetSupportedInputFormat() public method

Returns the name of the input format that this IFormatConverter supports
public GetSupportedInputFormat ( ) : string
return string

InsertPowerPointSlideInOneNote() protected method

Inserts a power point slide into a given section in OneNote as a page
protected InsertPowerPointSlideInOneNote ( int slideNumber, PowerPointOpenXml pptOpenXml, string imgsPath, OneNoteGenerator note, string sectionId, bool showComments = true, string commentsStr = "Comments", bool showNotes = true, string notesStr = "Notes", bool hiddenSlideNotIncluded = true ) : string
slideNumber int
pptOpenXml OneNoteConversionTool.FormatReaders.PowerPointOpenXml
imgsPath string
note OneNoteConversionTool.OutputGenerator.OneNoteGenerator
sectionId string
showComments bool
commentsStr string
showNotes bool
notesStr string
hiddenSlideNotIncluded bool
return string

ModifyInDesignHtmlLinks() protected method

change the links to have the full path
protected ModifyInDesignHtmlLinks ( HtmlAgilityPack.HtmlDocument htmlDoc, string htmlDir ) : void
htmlDoc HtmlAgilityPack.HtmlDocument
htmlDir string
return void

SeparatePages() protected method

Splits HtmlNodes into List of HtmlNodes based on page breaks
protected SeparatePages ( HtmlNode content ) : IEnumerable>
content HtmlAgilityPack.HtmlNode
return IEnumerable>

SetInDesignHtmlExportOptions() protected method

Sets the export options of the indesign document to HTML
protected SetInDesignHtmlExportOptions ( InDesign.Document doc ) : void
doc InDesign.Document
return void