欢迎来到传世资源网!
加载中...
正在加载,请耐心等待...

word转pdf 小软件源码

8.5玩家评分(1人评分)
详细介绍 最新评论 链接失效反馈

word转pdf 小软件源码 常用C#方法-第1张using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;namespace WordToPDF{ /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void WordBtn_Click(object sender, RoutedEventArgs e) { #region OldCode ////打开对话框 //Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog(); ////过滤器 //dialog.Filter = "文档类型|*.doc;*.docx"; ////允许选多个文件 //dialog.Multiselect = true; ////是否打开 //var result = dialog.ShowDialog(); //if (result == true) //{ // //总计 // int total = 0; // //保存路径 // string savePath = string.Empty; // //获得文件 // string[] files = dialog.FileNames; // System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); // watch.Start(); // for (int i = 0; i < files.Length; i ) // { // savePath = System.IO.Path.GetDirectoryName(files[0]); // //文件名 // string saveName = System.IO.Path.GetFileNameWithoutExtension(files[i]) ".pdf"; // //存在就转换 // if (System.IO.File.Exists(files[i])) // { // if (WordConvertPDF.WordToPDFHelper.WordToPDF(files[i], savePath @"\" saveName)) // { // total ; // } // } // } // watch.Stop(); // MessageBox.Show("成功转换了:" total " 个文件;耗时:" watch.Elapsed, "逆天友情提醒"); // if (!string.IsNullOrEmpty(savePath)) // { // System.Diagnostics.Process.Start(savePath); // } //} #endregion #region NewCode //打开对话框 Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog(); //过滤器 dialog.Filter = "文档类型|*.doc;*.docx"; //允许选多个文件 dialog.Multiselect = true; //是否打开 var result = dialog.ShowDialog(); if (result == true) { //保存路径 string savePath = string.Empty; //获得文件 string[] files = dialog.FileNames; savePath = System.IO.Path.GetDirectoryName(files[0]); if (!string.IsNullOrEmpty(savePath)) { System.Diagnostics.Process.Start(savePath); } System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start(); int total = WordConvertPDF.WordToPDFHelper.WordsToPDFs(files, savePath); watch.Stop(); MessageBox.Show("成功转换了:" total " 个文件;耗时:" watch.Elapsed, "逆天友情提醒"); } #endregion } private void PdfBtn_Click(object sender, RoutedEventArgs e) { MessageBox.Show("V1.1版本的时候会公开~敬请期待", "逆天友情提醒"); System.Diagnostics.Process.Start("http://www.dkill.net"); } private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e) { System.Diagnostics.Process.Start("https://github.com/dunitian/WordConvertPDF"); } }}

下载声明:

本站资源均有第三方用户自行上传分享推荐,非本站自制,仅供玩家做交流学习之用!切勿用于商业用途!游戏作品版权归原作者享有,如有版权问题,请附带版权证明至邮件,本平台将应您的要求删除。
相关推荐:pdf/Word/源码例子

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复