OneNote files are popularly used for taking notes. In certain situations, you might need to extract or insert an image in a OneNote .one document. This article covers how to insert or extract images from a OneNote file using C#.
- Insert or Extract Image from OneNote .one File – C# API Installation
- Insert Image in OneNote .one File in C#
- Extract Images from OneNote .one File using C#
Insert or Extract Image in OneNote .one File – .NET API Installation
Aspose.Note for .NET API supports creating or editing the OneNote files. You can configure it by downloading the DLL file from the Downloads section or using the below NuGet installation command in Microsoft Visual Studio IDE:
Insert Image in OneNote .one File in C#
You can insert an image in a OneNote document with the following steps:
- Initialize a LoadOptions class object.
- Load the input OneNote file with the Document class.
- Get the first page of the document with FirstChild property.
- Add the image to the page with appendChildLast method.
- Finally, save the output OneNote file.
The code snippet below shows how to insert an image in a OneNote .one document using C#:
Extract Images from OneNote .one File using C#
You can extract images from a OneNote file with the following steps:
- Firstly, load the input OneNote file with the Document class.
- Get all images using GetChildNodes method.
- Traverse the list and save output images.
The following code sample explains how to extract images from a OneNote document using C#:
Get Free API License
You can request a free temporary license for evaluating the API without any limitations.
In conclusion, you have learned how to extract or insert image into a OneNote .one file in C#. You can explore several other features of the API by taking a look at the documentation. Furthermore, you can contact us at the free support forum in case of any concerns.