# fz2doc **Repository Path**: hackor/fz2doc ## Basic Information - **Project Name**: fz2doc - **Description**: 方正小样与doc互转 - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-27 - **Last Updated**: 2026-08-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # fz2doc - Founder Document Conversion Tool fz2doc is a document conversion tool built on Python Flask and Vue.js, primarily designed to implement bidirectional format conversion between **Founder Typesetting Files (FBD)** and **Microsoft Word Documents (DOCX)**. The tool offers both a Graphical User Interface (GUI) and a Command Line Interface (CLI), supporting single-file conversion and batch conversion, while including comprehensive logging functionality. ## Key Features - **Bidirectional Conversion**: Supports FBD to DOCX and DOCX to FBD. - **Batch Processing**: Supports batch file conversion by specifying input and output directories. - **Graphical Interface**: Provides a Vue-based Web interface accessible via a local server. - **Command Line Support**: Provides a CLI tool for easy integration into automated workflows. - **Formula Support**: Integrates formula conversion logic (supports FZ/LaTeX formats). - **Layout Compatibility**: Supports reading PRO layout files to assist with FBD conversion. - **Log Tracking**: Records errors, warnings, and detailed information during the conversion process for easier troubleshooting. ## Project Structure ``` data/skyline/skyline-repo-cache/b4/d921e659101cd1b8ee3fb93e988d16884dbb024bcdb3d2769abc10b60f628b/ ├── backend/ # Core backend service code │ ├── api/app.py # Flask Web service API │ ├── cli.py # Command Line Interface (CLI) implementation │ ├── core/ │ │ ├── converters/ # File converters (FBD <-> DOCX) │ │ ├── parsers/ # File parsers │ │ └── utils/ # Utility classes (file operations, formula conversion, log management) │ └── config/ # Configuration files (font mappings, etc.) ├── frontend/ # Vue.js frontend application │ ├── src/ │ │ ├── views/ # Page views (Dashboard, FBDToDocx, DocxToFBD, Logs) │ │ └── router/ # Route configuration │ └── package.json # Frontend dependency configuration ├── desktop_app.py # Desktop app entry point (wraps web service as desktop program) ├── requirements.txt # Python dependencies list └── setup.py # Project installation configuration ``` ## Environment Preparation ### 1. Install Python Dependencies Ensure that Python 3.8 or higher is installed in your environment. ```bash pip install -r requirements.txt ``` ### 2. Install Frontend Dependencies (Optional, only required when modifying frontend code or needing a full build) ```bash cd frontend npm install ``` ## Usage Methods ### Method 1: Graphical Interface (Recommended) Run the following command to start the local server and open the application in the default browser: ```bash python desktop_app.py ``` Alternatively, if you have Node.js installed, you can also start the frontend and backend services separately for development purposes. ### Method 2: Command Line Interface (CLI) This project includes a fully functional command-line tool that allows you to execute conversion tasks directly in the terminal. **1. Single File Conversion** * **Founder FBD to Word DOCX**: ```bash python -m backend.cli fbd-to-docx [--pro-path ] ``` * **Word DOCX to Founder FBD**: ```bash python -m backend.cli docx-to-fbd ``` **2. Batch Conversion** * **Batch FBD to DOCX**: ```bash python -m backend.cli batch-fbd-to-docx ``` * **Batch DOCX to FBD**: ```bash python -m backend.cli batch-docx-to-fbd ``` **3. Start Web Service** If you only want to start the web service alone (without automatically opening the browser): ```bash python -m backend.cli serve ``` ## API Reference If you need to call conversion functions programmatically, the backend provides a RESTful API. * `POST /api/convert/fbd-to-docx`: Convert a single FBD file. * `POST /api/convert/docx-to-fbd`: Convert a single DOCX file. * `POST /api/convert/batch/fbd-to-docx`: Batch convert FBD files. * `POST /api/convert/batch/docx-to-fbd`: Batch convert DOCX files. * `GET /api/logs/recent`: Retrieve recent conversion logs. * `GET /api/health`: Health check endpoint. ## Important Considerations * **Font Mapping**: Founder documents may contain specific non-system fonts. The tool will attempt to map or preserve them based on `backend/config/font_mapping.json`. * **Complex Formulas**: Complex FBD formulas will attempt to convert to LaTeX or OMML format for insertion into Word documents. * **Layout Files (PRO)**: When converting FBD to DOCX, if a PRO file is provided, the tool will attempt to parse layout information (such as columns, pagination) to more accurately restore the document structure.