1、在VS程序中打开“解决方案资源管理器”,鼠标右键点击“引用”,“管理NuGet包”:
2、点击“搜索”,在搜索框中输入搜索内容,点击包,安装:
3、依次点击“OK”,"我接受",等待程序安装。
4、完成安装后,编辑如下代码,殂翼瑟擀实现格式转换:1. Word转ODTusing Spire.Doc;namespace WordtoODT{ class Progr锾攒揉敫am { static void Main(string[] args) { //创建Document类的对象 Document document = new Document(); //加载Word文档 document.LoadFromFile("sample.docx"); //保存为ODT格式 document.SaveToFile("ToODT.odt", FileFormat.Odt); } }}2. ODT转Wordusing Spire.Doc;namespace ODTtoWord{ class Program { static void Main(string[] args) { //创建Document类的对象 Document document = new Document(); //加载ODT文档 document.LoadFromFile("test.odt"); //保存为Word格式 document.SaveToFile("toWord.docx", FileFormat.Docx2013); } }}