資源簡介
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個文件信息
評論
共有 條評論