参考项目
C#的库,可以生成word,以及丰富的转换格式
https://www.e-iceblue.cn/spiredoc/word-conversion-feature.html
在此主要调用office本身的控件,来转换
https://github.com/Softcom/docx2pdf
windows下转换word格式较为简单,实际上就是调用office打开word,并转换
下面贴上C#核心代码,我稍微做了些修改
让转换过程不可见,并且转换完之后关闭word
/*
Copyright 2015 Softcom
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl