OneNote COM Add-in: Remove auto-converted URL hyperlinks.
⬇️ Download latest MSI installer — one-click install, no build required
This add-in adds a dedicated Hyperlinks tab to the OneNote Ribbon, plus right-click context menu entries:
OneNote automatically converts typed or pasted URLs into clickable hyperlinks with no built-in option to disable it. This add-in provides:
- Manual removal — scan the current page and restore auto-converted hyperlinks to plain text
- Selection removal — remove hyperlinks from selected text only
- Auto-monitoring — automatically detect and remove new auto-converted hyperlinks when enabled
- Clipboard cleanup — optional monitor that strips zero-width spaces from clipboard, only active within OneNote (default off)
- Copy clean text — right-click menu to copy selected text with zero-width spaces removed
- Smart detection — only removes OneNote auto-converted hyperlinks (where href equals display text), preserving manually created meaningful hyperlinks
OneNote has no API to disable auto-hyperlink conversion. Even after stripping a <a> tag, OneNote will immediately re-convert the plain URL text back into a hyperlink. To break this cycle, the add-in inserts a zero-width space (U+200B) at key URL patterns (:// and www.) when restoring plain text. The zero-width space is invisible to users but breaks OneNote's URL pattern matching, preventing re-conversion.
When you copy text containing these zero-width spaces, the Clipboard Monitor (optional, default off) automatically strips them from the clipboard so the URL remains clean when pasted elsewhere. This monitoring only activates when text is copied within OneNote.
- Visual Studio 2022 (with "Office/SharePoint development" workload)
- .NET Framework 4.8
- Microsoft OneNote (Microsoft 365)
- Windows 10/11
- Microsoft® OneNote® for Microsoft 365 MSO (Version 2605 Build 16.0.20026.20168) 64-bit
- Downloaded from Microsoft Store
# Open OneNoteHyperlinkRemover.sln in Visual Studio, or use command line:
msbuild OneNoteHyperlinkRemover.sln /p:Configuration=ReleaseOutput: bin\Release\
Option 1: MSI installer (recommended)
Download the latest OneNoteHyperlinkRemover.msi from Releases. Requires .NET Framework 4.8. The installer copies the DLL to Program Files, registers the COM component, and adds the OneNote add-in registry entry automatically. Restart OneNote after installation.
Note: Windows Defender Smart App Control may block the MSI installation since it's not code-signed. You can turn off Smart App Control or install manually using the scripts below.
Option 2: Manual register
# Build first, then run PowerShell as Administrator
.\Scripts\Register.ps1 -Configuration Release- Restart OneNote
- Find the add-in group on the Home tab
- Click Remove Page Links to scan and remove auto-converted hyperlinks on the current page
- Click Remove Selection Links to process selected text only
- Toggle Auto-remove to enable/disable automatic monitoring
- Toggle Auto-clean Clipboard ZWS to enable/disable zero-width space cleanup (only active within OneNote)
- Right-click selected text → Copy Text Without ZWS to copy clean text to clipboard
# Run PowerShell as Administrator
.\Scripts\Unregister.ps1Then restart OneNote.
This is a COM Add-in (not VSTO) because OneNote does not support VSTO project templates.
IDTExtensibility2— COM add-in lifecycle (OnConnection, OnDisconnection, etc.)IRibbonExtensibility— Ribbon UI definition and callbacks
| File | Description |
|---|---|
AddIn.cs |
Entry point — COM interface and Ribbon callbacks |
OneNoteHelper.cs |
OneNote COM API wrapper, manages IApplication lifecycle |
HyperlinkRemover.cs |
Core logic: parse page XML, detect and remove auto-converted hyperlinks |
ClipboardMonitor.cs |
Background clipboard watcher for zero-width space cleanup |
Strings.cs |
Bilingual string dictionary (zh/en) |
Ribbon\Ribbon.xml |
Ribbon UI definition |
Scripts\Register.ps1 |
Registration script |
Scripts\Unregister.ps1 |
Unregistration script |
- Get current page XML via
IApplication.GetPageContent() - Parse page structure using LINQ to XML (Outline → OE → T elements)
- Find
<a href="...">text</a>tags inside T element CDATA - Identify auto-converted hyperlinks (href equals display text, or display text is a URL)
- Replace auto-converted hyperlinks with plain text (with zero-width spaces to prevent re-linking)
- Write back modified page via
IApplication.UpdatePageContent()
Following OneMore's design: do not hold IApplication COM reference long-term. Each operation creates a new instance and releases it immediately, preventing interference with OneNote shutdown.
UI language is auto-detected from CultureInfo.CurrentUICulture. All Ribbon labels use getLabel callbacks that read from Strings.cs. To add a new language, extend the Map dictionary in Strings.cs.
The idea for this project had been on my mind for a long time, but I never got around to implementing it — until Coding Agents matured enough to make it possible with AI assistance.
The following links are the issues and discussions that inspired this project:
- SuperUser: OneNote 2010 — Remove hyperlink
- Reddit: Type a UNC path without creating a link
- Microsoft Q&A: Removing links in OneNote
- Microsoft Q&A: OneNote 2013 (zh-CN)
- Microsoft Q&A: How to paste plain text to OneNote
- Reddit: Hyperlinks in OneNote
- Microsoft Q&A: Why does the feature to remove link get disabled
- Microsoft Q&A: How to disable automatic hyperlinks or remove link
- Microsoft Q&A: How can I remove a hyperlink in OneNote and preserve the text
- OneMore — Feature-rich OneNote COM add-in (C#, .NET Framework 4.8)
OneNote COM 加载项:移除 OneNote 自动将 URL 转换为超链接的行为。
⬇️ 下载最新 MSI 安装包 — 一键安装,无需编译
本插件在 OneNote 功能区添加了一个独立的「超链接」标签页,并在右键菜单中添加了快捷操作:
OneNote 会自动将粘贴或输入的 URL 文本转换为可点击的超链接,且没有内置选项可以禁用此行为。本插件提供:
- 手动移除 — 一键扫描当前页面,将自动转换的超链接恢复为纯文本
- 选区移除 — 仅移除选中文字中的超链接
- 自动监控 — 开启后自动检测并移除新出现的自动超链接
- 剪贴板清理 — 可选的剪贴板监控,自动清除零宽空格,仅在 OneNote 内生效(默认关闭)
- 复制移除零宽空格后的文本 — 右键菜单,复制选中文字到剪贴板并清除零宽空格
- 智能识别 — 只移除 OneNote 自动转换的超链接(href 和显示文本相同),保留用户手动创建的有意义的超链接
OneNote 没有提供禁用自动超链接转换的 API。即使通过 COM 接口移除了 <a> 标签,OneNote 仍会立即将纯文本 URL 重新转换为超链接。为了打破这个循环,插件在恢复纯文本时向 URL 的关键位置(:// 和 www.)插入一个零宽空格(U+200B)。零宽空格对用户不可见,但能破坏 OneNote 的 URL 模式匹配,阻止重新转换。
当用户复制包含零宽空格的文本时,剪贴板监控(可选,默认关闭)会自动清除剪贴板中的零宽空格,确保粘贴到其他地方的 URL 保持干净。此监控仅在 OneNote 内复制文本时生效。
- Visual Studio 2022(需要"Office/SharePoint 开发"工作负载)
- .NET Framework 4.8
- Microsoft OneNote(Microsoft 365 版本)
- Windows 10/11
- Microsoft® OneNote® 适用于 Microsoft 365 MSO (版本 2605 Build 16.0.20026.20168) 64 位
- 下载地址:Microsoft Store
# 使用 Visual Studio 打开 OneNoteHyperlinkRemover.sln 编译
# 或使用命令行:
msbuild OneNoteHyperlinkRemover.sln /p:Configuration=Release编译输出在 bin\Release\ 目录。
方式一:MSI 安装包(推荐)
从 Releases 下载最新的 OneNoteHyperlinkRemover.msi。需要 .NET Framework 4.8。安装程序会自动将 DLL 复制到 Program Files、注册 COM 组件并添加 OneNote 加载项注册表项。安装后重启 OneNote 即可。
注意:由于安装包未签名,Windows Defender 智能应用控制可能会拦截安装。可以关闭智能应用控制,或使用下方脚本手动安装。
方式二:手动注册
# 先编译,然后以管理员权限运行 PowerShell
.\Scripts\Register.ps1 -Configuration Release- 重启 OneNote
- 在"开始"选项卡中找到插件分组
- 点击"移除本页超链接"扫描并移除当前页面的自动超链接
- 点击"移除选区超链接"仅处理选中文字
- 点击"自动移除本页超链接"切换按钮开启/关闭自动监控模式
- 点击"自动清理剪贴板零宽空格"切换按钮开启/关闭剪贴板清理(仅在 OneNote 内生效)
- 选中文字后右键 → "复制移除零宽空格后的文本"复制干净文本到剪贴板
# 以管理员权限运行
.\Scripts\Unregister.ps1然后重启 OneNote。
这是一个 COM Add-in(不是 VSTO),因为 OneNote 不支持 VSTO 项目模板。
IDTExtensibility2— COM 加载项生命周期(OnConnection、OnDisconnection 等)IRibbonExtensibility— Ribbon UI 定义和回调
| 文件 | 说明 |
|---|---|
AddIn.cs |
入口点,实现 COM 接口和 Ribbon 回调 |
OneNoteHelper.cs |
OneNote COM API 封装,管理 IApplication 生命周期 |
HyperlinkRemover.cs |
核心逻辑:解析页面 XML,识别并移除自动超链接 |
ClipboardMonitor.cs |
后台剪贴板监控,清理零宽空格 |
Strings.cs |
中英双语字符串字典 |
Ribbon\Ribbon.xml |
Ribbon UI 定义 |
Scripts\Register.ps1 |
注册脚本 |
Scripts\Unregister.ps1 |
注销脚本 |
- 通过
IApplication.GetPageContent()获取当前页面的 XML 内容 - 使用 LINQ to XML 解析页面结构(Outline → OE → T 元素)
- 在 T 元素的 CDATA 内容中查找
<a href="...">text</a>标签 - 识别自动转换的超链接(href 和显示文本相同或显示文本是 URL)
- 将自动超链接替换为纯文本(插入零宽空格防止重新转换)
- 通过
IApplication.UpdatePageContent()写回修改后的页面
参考 OneMore 项目的设计:不长期持有 IApplication COM 引用,每次操作创建新实例并及时释放,避免阻止 OneNote 正常关闭。
UI 语言根据 CultureInfo.CurrentUICulture 自动检测。所有 Ribbon 标签通过 getLabel 回调从 Strings.cs 读取。如需添加新语言,扩展 Strings.cs 中的 Map 字典即可。
得益于 Coding Agent 发展迅速,才有机会借助 AI 付诸实践。
以下链接提到的问题是我创建这个项目的初衷和灵感:
- SuperUser: OneNote 2010 — 移除超链接
- Reddit: 输入 UNC 路径时不要自动创建链接
- Microsoft Q&A: 移除 OneNote 中的链接
- Microsoft Q&A: OneNote 2013
- Microsoft Q&A: 如何向 OneNote 粘贴纯文本
- Reddit: OneNote 中的超链接
- Microsoft Q&A: 为什么移除链接功能被禁用了
- Microsoft Q&A: 如何禁用自动超链接或移除链接
- Microsoft Q&A: 如何在 OneNote 中移除超链接并保留文本
- OneMore — 功能丰富的 OneNote COM 加载项(C#,.NET Framework 4.8)

