资源简介
winForm word转pdf excel转pdf
winForm word转pdf excel转pdf
winForm word转pdf excel转pdf
winForm word转pdf excel转pdf
代码片段和文件信息
using System;
using System.Windows.Forms;
using Microsoft.Office.Interop.Word;
using Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Interop.Excel;
namespace WinWordToPdf
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
OpenFileDialog opg = new OpenFileDialog();
opg.Filter = “word(*.docx)|*.docx“;
if (opg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
WordConvertPdf(opg.FileName “D:\\sss.pdf“ WdExportFormat.wdExportFormatPDF);
}
}
private void btnExcel_Click(object sender EventArgs e)
{
OpenFileDialog opg = new OpenFileDialog();
opg.Filter = “Excel(*.xls)|*.xlsx“;
if (opg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
ExcelConvertPdf(opg.FileName “D:\\sss1.pdf“ XlFixedFormatType.xlTypePDF);
}
}
private bool WordConvertPdf(string sourcePath string targetPath WdExportFormat exportFormat)
{
bool result;
object paramMissing = Type.Missing;
Microsoft.Office.Interop.Word.ApplicationClass wordApplication = new Microsoft.Office.Interop.Word.ApplicationClass();
Document wordDocument = null;
try
{
object paramSourceDocPath = sourcePath;
string paramExportFilePath = targetPath;
WdExportFormat paramExportFormat = exportFormat;
bool paramOpenAfterExport = false;
WdExportOptimizeFor paramExportOptimizeFor =
WdExportOptimizeFor.wdExportOptimizeForPrint;
WdExportRange paramExportRange = WdExportRange.wdExportAllDocument;
int paramStartPage = 0;
int paramEndPage = 0;
WdExportItem paramExportItem = WdExportItem.wdExportDocumentContent;
bool paramIncludeDocProps = true;
bool paramKeepIRM = true;
WdExportCreateBookmarks paramCreateBookmarks =
WdExportCreateBookmarks.wdExportCreateWordBookmarks;
bool paramDocStructureTags = true;
bool paramBitmapMissingFonts = true;
bool paramUseISO19005_1 = false;
wordDocument = wordApplication.Documents.Open(
ref paramSourceDocPath ref paramMissing ref paramMissing
ref paramMissing ref paramMissing ref paramMissing
ref paramMissing ref paramMissing ref paramMissing
ref paramMissing ref paramMissing ref paramMissing
ref paramMissing ref paramMissing ref paramMissing
ref paramM
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 781104 2009-08-31 02:00 WinWordToPdf\bin\Debug\Microsoft.Office.Interop.Word.dll
文件 1648465 2010-01-10 22:10 WinWordToPdf\bin\Debug\Microsoft.Office.Interop.Word.xm
文件 10240 2011-09-14 15:53 WinWordToPdf\bin\Debug\WinWordToPdf.exe
文件 26112 2011-09-14 15:53 WinWordToPdf\bin\Debug\WinWordToPdf.pdb
文件 11600 2011-09-14 15:56 WinWordToPdf\bin\Debug\WinWordToPdf.vshost.exe
文件 490 2010-03-17 22:39 WinWordToPdf\bin\Debug\WinWordToPdf.vshost.exe.manifest
文件 5944 2011-09-14 15:53 WinWordToPdf\Form1.cs
文件 2670 2011-09-14 15:46 WinWordToPdf\Form1.Designer.cs
文件 5817 2011-09-14 15:46 WinWordToPdf\Form1.resx
文件 2152 2011-09-14 15:02 WinWordToPdf\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6603 2011-09-14 15:53 WinWordToPdf\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 232 2011-09-14 15:49 WinWordToPdf\obj\x86\Debug\GenerateResource.read.1.tlog
文件 582 2011-09-14 15:49 WinWordToPdf\obj\x86\Debug\GenerateResource.write.1.tlog
文件 855 2011-09-14 15:56 WinWordToPdf\obj\x86\Debug\WinWordToPdf.csproj.FileListAbsolute.txt
文件 10240 2011-09-14 15:53 WinWordToPdf\obj\x86\Debug\WinWordToPdf.exe
文件 180 2011-09-14 15:49 WinWordToPdf\obj\x86\Debug\WinWordToPdf.Form1.resources
文件 26112 2011-09-14 15:53 WinWordToPdf\obj\x86\Debug\WinWordToPdf.pdb
文件 180 2011-09-14 15:40 WinWordToPdf\obj\x86\Debug\WinWordToPdf.Properties.Resources.resources
文件 493 2011-09-14 15:02 WinWordToPdf\Program.cs
文件 1376 2011-09-14 15:02 WinWordToPdf\Properties\AssemblyInfo.cs
文件 2874 2011-09-14 15:02 WinWordToPdf\Properties\Resources.Designer.cs
文件 5612 2011-09-14 15:02 WinWordToPdf\Properties\Resources.resx
文件 1097 2011-09-14 15:02 WinWordToPdf\Properties\Settings.Designer.cs
文件 249 2011-09-14 15:02 WinWordToPdf\Properties\Settings.settings
文件 4331 2011-09-14 15:40 WinWordToPdf\WinWordToPdf.csproj
文件 878 2011-09-14 15:02 WinWordToPdf.sln
目录 0 2011-09-14 15:02 WinWordToPdf\obj\x86\Debug\TempPE
目录 0 2011-09-14 15:53 WinWordToPdf\obj\x86\Debug
目录 0 2011-09-14 15:40 WinWordToPdf\bin\Debug
目录 0 2011-09-14 15:02 WinWordToPdf\obj\x86
............此处省略7个文件信息
相关资源
- SignalR 2.0 Winform版
- C# winform Socket大文件传输
- C#将Excel导入到Access数据库表(winFor
- winform图片标尺,画矩形
- C# 斑马标签打印 WEBWINFORM
- C#动画控件超炫
- WeifenLuo.WinFormsUI.Docking3.1.0
- Bunifu_Ui_WinForms_v1.10.0.0_Downloadly.ir.rar
- Winform可视化打印模板设计
- 最新9个C# .NET Winform的多线程进度条源
- Winform绘制圆形和椭圆形图章
- c# 图像旋转 winform 窗体 图片转动
- 优化C# WinForm从中国银行网站抓取汇率
- C#项目 网吧管理系统
- Winform通用经典快速开发CS框架-outloo
- 人事管理系统 winform代码
- 宾馆管理系统(c#2008access2003winform)
- C# Winform 酒店管理系统源代码及数据
- C# Winform 弹窗等待效果图
- winform自动更新程序
- winform c# mschart demo 范例
- WinForm 实现图片滚动
- c#winform做的hosts文件管理
- 控件重绘 C# WinForm控件美化扩展系列之
- .net winform插件大全 .net 控件大全.net插
- winform chart动态跟进式折线图
- WinForm C#Demo 会员与消费系统 进销存系
- c# 模仿windows扑克游戏
- 幸运52winform写的游戏
- winform 60种非常漂亮界面样式\\皮肤(
评论
共有 条评论