原創(chuàng)|使用教程|編輯:王香|2017-09-01 11:14:13.000|閱讀 412 次
概述:Spire.Doc 是一個(gè)MS Word 組件,使用戶可以直接執(zhí)行各種Word文檔處理任務(wù), 分為.NET、WPF和Silverlight 三個(gè)版本,本文介紹了如何在Word文檔中進(jìn)行文件格式轉(zhuǎn)換。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
NPOI
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NPOI.XWPF.UserModel; using System.IO; namespace NPOI { class Program { static void Main(string[] args) { //Load document XWPFDocument doc = new XWPFDocument(new FileStream("../../../Data/Sample.doc", FileMode.Open)); //Save the file using (FileStream sw = File.Create("ConvertedFile.docx")) { doc.Write(sw); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Spire.Doc; namespace Spire.Doc { class Program { static void Main(string[] args) { //Load document Document doc = new Document(); doc.LoadFromFile("../../../Data/Sample.doc"); //Save the file to other format string fileName = "ConvertedFile"; doc.SaveToFile(fileName+".xlsx",FileFormat.Docx2010); doc.SaveToFile(fileName+".pdf",FileFormat.PDF); doc.SaveToFile(fileName + ".txt", FileFormat.Txt); doc.SaveToFile(fileName + ".svg", FileFormat.SVG); } } }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn