Skip to content

Comments

Desktop: Support importing .one files from OneNote 2016#13391

Merged
laurent22 merged 45 commits intolaurent22:devfrom
personalizedrefrigerator:work/import-onenote-2016
Oct 16, 2025
Merged

Desktop: Support importing .one files from OneNote 2016#13391
laurent22 merged 45 commits intolaurent22:devfrom
personalizedrefrigerator:work/import-onenote-2016

Conversation

@personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Oct 6, 2025

Summary

This pull request adds support for importing OneNote 2016/OneNote desktop .one files from the desktop app.

Background

The desktop app previously only supported importing alternate format notebooks downloaded directly from SharePoint or OneDrive.

These notebooks are imported with a fork of msiemens/onenote.rs, rendered to HTML with msiemens/one2html, then imported into Joplin in HTML format. The msiemens/onenote.rs parser, however, as stated in the one2html readme, onenote.rs lacks support for files created by the OneNote desktop app:

This pull request updates the forked onenote.rs to support parsing OneNote 2016-format notebooks.

Import process

Although this pull request makes it possible to import data from OneNote 2016/OneNote desktop, the process is still somewhat complicated. For possible improvements, see the "Follow-up tasks" section.

To import a .one file:

  1. Move the OneNote 2016 .one files into a folder.
  2. Convert the folder to a .zip file.
  3. Select the .zip file from Joplin's File > Import > ZIP dialog.

To import a .onepkg file:

  1. Extract the .onepkg file.
    • onepkg files are CAB archives. On Windows, it may be possible to extract the onepkg file by first changing the extension to .cab.
  2. Create a new .zip file containing the .one and .onetoc2 files from step 1.
  3. Import the .zip file from step 2 using Joplin's file > import menu.

Change summary

  • Added a new local_onestore module and moved the previous alternate format parsing logic into fsshttpb_onestore.
  • Implemented parsing logic for the OneNote desktop format in local_onestore.
  • Created a onestore module with adapter logic.
  • Refactored onenote-converter into multiple sub-packages (managed with cargo workspaces).

Possible follow-up tasks

  • Allow selecting .one files from the OneNote importer dialog. Currently, only .zip files can be selected.
  • Allow selecting .onepkg files from the OneNote importer dialog.
    • onepkg files are CAB archives containing .one and .onetoc2 files. Joplin would need support for extracting the one files from the onepkg archive.
  • Add automated tests that can run in CI.

Testing

Automated testing

An automated test has been created that uses a sample .one file from OfficeDev/Interop-TestSuites. At present, it must be run manually with cargo test from packages/onenote-converter and does not run in CI.

Manual testing

It has been verified that the OneNote importer can successfully import a user-provided .onepkg file by:

  1. Converting the .onepkg file to a .zip file.
  2. Importing the .zip file from Joplin.

@personalizedrefrigerator personalizedrefrigerator added import Related to importing files such as ENEX, JEX, etc. desktop All desktop platforms labels Oct 6, 2025
personalizedrefrigerator and others added 23 commits October 6, 2025 14:01
Applying suggestions from `cargo clippy`, removing an unused field
Due to a problematic merge, the Rust edition was reset to 2018 for the parser package. (The other packages use Rust 2024)
This reverts commit acbcd85.

acbcd85 changed the import order in a
number of otherwise untouched files. cargo fmt should be re-run in a
separate pull request to simplify review.
Currently, only used in the Rust tests (and not in CI)
@personalizedrefrigerator personalizedrefrigerator marked this pull request as ready for review October 8, 2025 17:31
@laurent22
Copy link
Owner

There's a conflict on lib.rs

@personalizedrefrigerator
Copy link
Collaborator Author

personalizedrefrigerator commented Oct 9, 2025

I've found a bug related to how the parser handles . I'm currently encountering the following error when trying to import this file from the OfficeDev/InteropTestSuites and this other file from the Apache Tika test suites:

Malformed OneNote file data: unexpected object type: 0x20046

I'm converting this to a draft until the bug is fixed.

Edit: Notes:

  • One possibility is that this is specific to .one files created with older versions of OneNote (the problematic FileSyncWOPI_OneNoteWithODB.one was created 10+ years ago, but the testOneNote1.one seems to have been uploaded more recently).
  • The 0x20046 ID corresponds to a version history metadata node.

@personalizedrefrigerator personalizedrefrigerator marked this pull request as draft October 9, 2025 22:30
@personalizedrefrigerator personalizedrefrigerator marked this pull request as ready for review October 13, 2025 19:25
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed from src/parser/reader.rs, with the following changes: Added tests, added absolute_offset, advance, and with_updated_bounds methods.

@laurent22 laurent22 merged commit 5ef37d9 into laurent22:dev Oct 16, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop All desktop platforms import Related to importing files such as ENEX, JEX, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants