Skip to content

Repository files navigation

RTFtool

A Windows desktop utility written in Go for batch processing RTF and DOCX documents, primarily targeting Clinical Trial statistical reports outputs generated by SAS workflow.

Features

  • RTF Page Check — Scans all RTF files in a folder (recursively) and validates that the page count rendered by Microsoft Word matches the Page X of Y marker in the RTF text. Mismatches trigger a section-level deep scan to pinpoint the discrepancy. Files are processed in parallel, one Word instance per CPU thread.

  • RTF Combine (Specify) — Merges multiple RTF files into a single RTF. Optionally generates a hyperlinked Table of Contents extracted from each file's IDX bookmark and \s999 \b title, and rewrites all Page X of Y footers to reflect the merged document's actual pagination. Operates on raw RTF text without requiring Word.

  • Docx/RTF Combine (General) — Merges multiple DOCX or RTF files into a single DOCX via the Word COM interface. Supports optional TOC generation.

  • RTF Converter — Converts between formats via Word COM:

    • RTF → PDF (with automatic optimization: bookmark expansion + Fast Web View)
    • RTF → DOCX
    • DOCX → RTF (single file or batch folder)

All settings and paths are saved automatically on exit and restored on next launch.

Requirements: Windows with Microsoft Word installed. Close all open Word documents before running any function.


License

This project is released under the MIT License.

The MIT License is a permissive open-source license. It allows anyone to use, copy, modify, merge, publish, distribute, sublicense, or sell copies of this software — for any purpose, including commercial use — with minimal restrictions. The only requirement is that the original copyright notice and license text are included in any substantial copy or distribution of the software.

In short: you are free to do almost anything with this code, as long as you keep the copyright notice. The authors provide the software "as is" with no warranty of any kind.


RTFtool(中文说明)

一个用 Go 编写的 Windows 桌面工具,用于批量处理 RTF 和 DOCX 文档,主要面向 SAS 流程生成的临床试验统计报告。

功能

  • RTF Page Check(页码校验) — 递归扫描文件夹内所有 RTF 文件,对比 Microsoft Word 实际渲染页数与 RTF 文本中 Page X of Y 标记是否一致。不一致时自动定位到出错的节。按 CPU 线程数并行处理,每个线程独立启动一个 Word 实例。

  • RTF Combine - Specify(RTF 合并,指定样式) — 将多个 RTF 文件合并为一个。可选自动生成带超链接的目录(从每个文件的 IDX 书签和 \s999 \b 标题提取),并将所有 Page X of Y 页脚重写为合并后的实际页码。直接操作 RTF 文本,无需调用 Word。

  • Docx/RTF Combine - General(通用合并) — 通过 Word COM 接口将多个 DOCX 或 RTF 文件合并为一个 DOCX,支持可选生成目录。

  • RTF Converter(格式转换) — 通过 Word COM 进行格式转换:

    • RTF → PDF(自动优化:展开书签 + Fast Web View)
    • RTF → DOCX
    • DOCX → RTF(支持单文件或批量文件夹)

所有路径和配置在关闭窗口时自动保存,下次启动自动恢复。

前置条件: Windows 系统,已安装 Microsoft Word。运行任何功能前请先关闭所有已打开的 Word 文档。


许可证

本项目基于 MIT 许可证 发布。

MIT 许可证是一种宽松的开源许可证。它允许任何人出于任何目的(包括商业用途)自由使用、复制、修改、合并、发布、分发、再授权或出售本软件的副本,限制极少。唯一的要求是:在软件的实质性副本或分发版本中保留原始版权声明和许可证文本。

简而言之:你几乎可以对这份代码做任何事,只需保留版权声明。作者不提供任何形式的担保,软件按"现状"提供。

About

This tool features a GUI that merges clinical trial TFL outputs in RTF, checks page numbers, and converts them to PDF or Docx.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages