Published on November 25, 2018 | classified in MySQL | comments: | reading times:
In word, using ODBC driver and office macro to control report output
Download tool
Tool download:
Links:
Extraction code: mhtd
Download the driver source you want to use according to the version of MySQL database
You can also download it on the official website:
Double click to install ODBC
Open windows control panel
Open windows control panel, management tools, open ODBC 64 (please choose according to the version)
Add ODBC data source
Click add, select the corresponding version of MySQL ODBC, click finish, and the connection option will appear
After the second step is installed successfully, the corresponding ODBC will appear
There are two versions of 8.0, one is ANSI driver and the other is Unicode driver.
The Unicode driver version provides more character set support, that is, multilingual support. The ANSI driver version is for a limited range of character sets.
Here, add 8.0 Unicode driver as an example
Data source name is mysql8
Open the word option and set the macro
Word connect data source
Unpack the package and open dbexportdoc v1.0 for mysql.doc
Connect to the database, change the corresponding user name, password and data source name
Export database table structure
Select the appropriate table and export
Error has been reported in the last export step since the first attempt. The command is invalid
Later, I restarted the computer and it was OK again. I don't know why
Download the dynamic soft code generation tool and unzip the installation
Download address:
Extraction code: 09hq
After decompression, run codematic2.msi to install. After the installation is successful, the desktop appears
Running dynamic soft code generator
Select new database server, select corresponding database and connect
Then restart the software
Connect to server, select database document generator
Select database and table, click generate
The document is generated
Installing the python environment
Official website:
Check add environment variable during installation
Be sure to check install PIP plug-in
Install mysql2docx plug-in
Open CMD command window, input
pip install Mysql2docx
pip install Mysql2docx
pip install Mysql2docx
The mysql2docx plug-in will be downloaded and installed automatically
After installation, you are prompted to upgrade pip18, which can be ignored
Generate documents
CMD command box continue input
Python
python
python
Entering Python command mode
Then enter and execute the following three commands respectively
from Mysql2docx import Mysql2docx
from Mysql2docx import Mysql2docx
from Mysql2docx import Mysql2docx
m=Mysql2docx()
m=Mysql2docx()
m.do('127.0.0.1','root','password','db_test',3306)
m.do('127.0.0.1','root','password','db_test',3306)
m.do('127.0.0.1','root','password','db_test',3306)