快速开始

这是 /zh-CN/ 文档树下的中文快速开始页。

安装与构建

cmake -S . -B build
cmake --build build
cmake --install build --prefix install

顶层构建默认启用 BUILD_CLI,因此会构建 featherdoc_cli。如果只需要库, 可以显式传入 -DBUILD_CLI=OFF

PDF 支持仍是实验性、显式开启的能力。只有在需要 PDF 工作流页面和 CLI 入口时, 才构建 FEATHERDOC_BUILD_PDFFEATHERDOC_BUILD_PDF_IMPORT

最小 C++ 用法

#include <featherdoc.hpp>

int main() {
    featherdoc::Document doc{"input.docx"};
    if (doc.open()) {
        return 1;
    }

    doc.paragraphs().add_run("Generated by FeatherDoc");
    return doc.save_as("output.docx") ? 1 : 0;
}

下一步阅读