Saved searches
Use saved searches to filter your results more quickly
Cancel Create saved search
Sign up Reseting focus
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
The "Code to Document and PDF Converter" is a tool designed to streamline the integration of source code into academic manuscripts, theses, and technical documents. With a focus on enhancing the documentation process, this script automates the conversion of code snippets into well-formatted Microsoft Word (.docx) documents and PDF files.
Notifications You must be signed in to change notification settings
roylandpepano/code-to-doc
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Go to file
Folders and files
Last commit message
Last commit date
Latest commit
History
View all files
Repository files navigation
Code to Document and PDF Converter
This script is designed to convert source code files into a Microsoft Word (.docx) document and a PDF file. It is particularly useful for authors working on a thesis manuscript who want to include code samples within their document. By automating the conversion process, it saves time and effort in manually copying and formatting code snippets.
Features
  - Converts source code of a project into a well-formatted Microsoft Word document and a PDF file.
 
  - Facilitates the selection of code sections to be included in the thesis manuscript.
 
  - Accelerates the process of integrating code samples into the manuscript.
 
How to Use
  - Runtime Measurement: The runtime of the program is measured to provide an idea of its execution time.
 
  - Folder Path Input: The user is prompted to enter the filepath of the folder containing the source code files.
 
  - Document Creation: The script creates a new Microsoft Word document and sets the column layout to two columns.
 
  - Code Inclusion: It traverses through the specified folder and its subdirectories, opening each source code file. The code content is then transferred to the Word document.
 
  - Header Formatting: For each code file, a header is added to indicate the file's name. This header is stylized with Arial font, size 10, bold, italic, and underlined.
 
  - Code Formatting: The code lines are added to the document with a consistent format. Each line is styled with Arial font, size 9.
 
  - Saving Documents: The script saves the generated Word document with the same name as the input folder but with a ".docx" extension. It also converts the Word document to a PDF file for quicker viewing and reference.
 
  - Completion Message: Once the conversion process is complete, the script prints a success message along with the filenames of the generated .docx and .pdf files.
 
  - Program Runtime: The total runtime of the program is displayed at the end, indicating how long the conversion process took.
 
Dependencies