没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|使用教程|编辑:李显亮|2020-11-24 10:44:09.870|阅读 551 次
概述:Spire系列文档处理API是国产开发工具中功能可媲美Aspose的强大控件,帮助开发者轻松将文档功能集成到应用程序中。临近年终,小编为您倾情献上Spire.Doc在各类开发语言中格式转换的示例教程,记得收藏哦!
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
将文档从一种格式转换为另一种格式是Spire.Doc的主要功能之一。这种转换只不过是加载和保存操作的组合。因此,使用Spire.Doc可以将文档从任何受支持的加载格式转换为任何受支持的保存格式。
本文整理了包括在C#中以下文件格式的转换指南,希望对您有所帮助:
>>你可以点击这里下载Spire.Doc for .NET测试体验。
(篇幅较长,建议收藏阅读)
using System; using System.Windows.Forms; using Spire.Doc; using Spire.Doc.Documents; namespace to XML { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //Create word document Document document = new Document(); document.LoadFromFile(@"D:\Sample.doc"); //Save doc file. document.SaveToFile("Sample.xml", FileFormat.Xml); //Launching the MS Word file. WordDocViewer("Sample.xml"); } private void WordDocViewer(string fileName) { try { System.Diagnostics.Process.Start(fileName); } catch { } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Spire.Doc; namespace Xml2Word { class Program { static void Main(string[] args) { Document doc = new Document(); doc.LoadFromFile("sample.xml", FileFormat.Xml); doc.SaveToFile("test.doc", FileFormat.Doc); } } }
using Spire.Doc; namespace XML2PDf { class Program { static void Main(string[] args) { Document mydoc = new Document(); mydoc.LoadFromFile(@"..\sample.xml", FileFormat.Xml); mydoc.SaveToFile("Test.doc", FileFormat.Doc); mydoc.SaveToFile("test.pdf", FileFormat.PDF); System.Diagnostics.Process.Start("Test.pdf"); } } }
using System; using Spire.Doc; using Spire.Doc.Documents; namespace DoctoPDF { class toPDF { static void Main(string[] args) { //Load Document Document document = new Document(); document.LoadFromFile(@"E:\work\documents\TestSample.docx"); //Convert Word to PDF document.SaveToFile("toPDF.PDF", FileFormat.PDF); //Launch Document System.Diagnostics.Process.Start("toPDF.PDF"); } } }
using System; using System.Windows.Forms; using Spire.Doc; using Spire.Doc.Documents; namespace tohtml_3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //Create word document Document document = new Document(); document.LoadFromFile(@"D:\Work\Stephen\2011.12.05\Sample.doc"); //Save doc file. document.SaveToFile("Sample.txt", FileFormat.Txt); //Launching the MS Word file. WordDocViewer("Sample.txt"); } private void WordDocViewer(string fileName) { try { System.Diagnostics.Process.Start(fileName); } catch { } } } }
using Spire.Doc; using Spire.Doc.Documents; namespace Word_to_HTML { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //Create word document Document document = new Document(); document.LoadFromFile(@"..\wordtohtml.doc"); //Save doc file to html document.SaveToFile("toHTML.html", FileFormat.Html); WordDocViewer("toHTML.html"); } private void WordDocViewer(string fileName) { try { System.Diagnostics.Process.Start(fileName); } catch { } } } }
using System; using Spire.Doc; using Spire.Doc.Documents; namespace Html2Doc { class Program { static void Main(string[] args) { Document document = new Document(); document.LoadFromFile(@"D:\test.html",FileFormat.Html,XHTMLValidationType.None); document.SaveToFile("test.doc", FileFormat.Doc); } } }
using Spire.Doc; using System; namespace DOCRTF { class Program { static void Main(string[] args) { } private void button1_Click(object sender, EventArgs e) { //Create word document Document document = new Document(); document.LoadFromFile(@"D:\Sample.doc"); //Save doc file. document.SaveToFile("Sample.rtf", FileFormat.Rtf); //Launching the MS Word file. WordDocViewer("Sample.rtf"); } private void WordDocViewer(string fileName) { try { System.Diagnostics.Process.Start(fileName); } catch { } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.Drawing.Imaging; using Spire.Doc; using Spire.Doc.Documents; namespace HTML2Image { class Program { static void Main(string[] args) { } } }
using System; using System.Collections.Generic; using System.Text; using Spire.Doc; namespace Doc_to_xps { class Program { static void Main(string[] args) { //doc file String file = "doc to xpsdoc.docx"; //open doc document Document doc = new Document(file); //convert to xps file. doc.SaveToFile("doc to xpsSample.xps", FileFormat.XPS); System.Diagnostics.Process.Start("doc to xpsSample.xps"); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Spire.Doc; using Spire.Doc.Documents; using Spire.Doc.Fields; namespace HTML2PDFXPS { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Document document = new Document(); document.LoadFromFile("Good.htm", FileFormat.Html, XHTMLValidationType.None); //Save html to PDF. document.SaveToFile("Sample.pdf", FileFormat.PDF); } private void button2_Click(object sender, EventArgs e) { Document document = new Document(); document.LoadFromFile("Good.htm", FileFormat.Html, XHTMLValidationType.None); //Save html to PDF. document.SaveToFile("Sample.xps", FileFormat.XPS); } } }
using Spire.Doc; namespace wordconversion.Case { class WordtoSVG { public WordtoSVG() { Document doc = new Document(); doc.LoadFromFile("Sample.docx"); doc.SaveToFile("result.svg", FileFormat.SVG); } } }如果您有任何疑问或需求,请随时,我们很高兴为您提供查询和咨询。
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@wqylolg.cn
本教程将向您展示如何用MyEclipse开发EJB 3无状态会话Bean,欢迎下载最新版IDE体验!
DHTMLX 产品支持构建功能丰富的预订系统,从而简化针对不同行业的预约安排。Scheduler 组件丰富的功能(可自定义的日历视图、重复事件等)与 Booking 小部件现成的预订管理 UI 相结合,满足您构建现代化 Web 预订解决方案所需。
在 Excel 中删除重复行对于维护干净、准确和一致的数据集至关重要。在本篇博文中,我们将向您展示如何使用 Python 以编程方式删除 Excel 工作表中的重复行。
无论是零售、物流还是医疗保健,旋转条形码图像的功能都能增强不同应用的灵活性和适应性。使用Aspose.BarCode for Java,您可以轻松旋转条形码图像,确保它们无缝融入应用程序的设计和布局。
Spire.Doc for .NET 是一款专门对 Word 文档进行操作的 .NET 类库。
Spire.Office for .NET专业的.NET Office套件,涵盖office文档创建、编辑、转换、管理和OCR内容识别等操作
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@wqylolg.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢