This project, I developed for ZeroAndOne Developers community, is aimed at efficiently manipulating specific data within a Word document and exporting it as a PDF. As a Software Development Associate at ZeroAndOne Developers, I've been tasked with completing this project to meet the requirements of our clients. The application is designed to replace text while maintaining formatting, perform calculations within table columns, and integrate a user-friendly Streamlit dashboard for input handling.
- Text Replacement: Replace text within paragraphs and tables while preserving formatting.
- Calculation in Tables: Perform calculations within table columns based on user-defined factors.
- PDF Export: Export the modified Word document as a PDF.
- Streamlit Dashboard: Integrate a Streamlit dashboard for user input and interaction.
To use this application, follow these steps:
- Clone the repository to your local machine.
git clone <repository_url>
- Install the required dependencies. Ensure you have Python installed on your system.
pip install -r requirements.txt
- Run the application using the following command:
streamlit run main.py
-
Enter the password when prompted. The default password is stored securely.
-
Fill in the required details in the Streamlit dashboard:
- Company Name
- Address
- Factor (for calculations)
- Click on the "Generate Documents" button to generate the modified Word document and export it as a PDF.
-
Python Libraries:
- streamlit: Used for creating the user-friendly dashboard.
- python-docx: Utilized for manipulating Word documents.
- comtypes: Employed for PDF export functionality.
-
Code Organization:
- main.py: Contains the main application code, including Streamlit dashboard setup, document manipulation, and PDF export functionality.
- Template_for_word_replace.docx: Template Word document for data replacement.
- requirements.txt: List of Python dependencies.
- Password Protection:
- Enter the password when prompted to access the application.
- Streamlit Dashboard:
- Input Company Name, Address, and Factor in the provided fields.
- Click on the "Generate Documents" button to initiate the document modification process.
- Document Modification:
- The application replaces placeholders in the document with user-provided data.
- It performs calculations within table columns based on the specified factor.
- PDF Export:
- The modified document is saved as modified_document.docx.
- It is then converted to PDF format and saved as final.pdf.
For any issues or inquiries, please open an issue in the GitHub repository or contact .
Contributions to the project are welcome! Feel free to open pull requests with improvements or additional features.