OWord.ApplicationClass word = new oWord.ApplicationClass() Word to XPS public void PrintWord(string wordfile) Net Framework 3.5, the XPS virtual printer will be installed by default. If we want to convert Word or Excel to XPS, we can use XPS virtual printer. Persentation.SaveAs(targetPath, targetFileType, .msoTrue) Persentation = (sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse) Private bool Convert(string sourcePath, string targetPath, PpSaveAsFileType targetFileType) That Free PDF Converter is also created via C#. WorkBook.ExportAsFixedFormat(targetType, target, XlFixedFormatQuality.xlQualityStandard, true, false, missing, missing, missing, missing) īy the way, I found a Free PDF Converter which can convert office files to PDF. Missing, missing, missing, missing, missing, missing, missing, missing, missing) WorkBook = (sourcePath, missing, missing, missing, missing, missing, } Convert Excel to PDF private bool Convert(string sourcePath, string targetPath, XlFixedFormatType targetType) WordApplication.Quit(ref paramMissing, ref paramMissing, ref paramMissing) WordDocument.Close(ref paramMissing, ref paramMissing, ref paramMissing) ParamBitmapMissingFonts, paramUseISO19005_1, ParamKeepIRM, paramCreateBookmarks, paramDocStructureTags, ParamEndPage, paramExportItem, paramIncludeDocProps, ParamExportOptimizeFor, paramExportRange, paramStartPage, WordDocument.ExportAsFixedFormat(paramExportFilePath, Ref paramMissing, ref paramMissing, ref paramMissing, Ref paramSourceDocPath, ref paramMissing, ref paramMissing, Word.WdExportCreateBookmarks paramCreateBookmarks = Word.WdExportOptimizeFor paramExportOptimizeFor = Word.WdExportFormat paramExportFormat = exportFormat Word.ApplicationClass wordApplication = new Word.ApplicationClass() Convert Word to PDF private bool Convert(string sourcePath, string targetPath, Word.WdExportFormat exportFormat) Therefore, we can also use SaveAs for Word. In this method, I use ExportAsFixedFormat for Word and Excel and SaveAs for Powerpoint.Īctually, the SaveAs method can support several formats. PowerPoint.PpSaveAsFileType ppType = .PpSaveAsFileType.ppSaveAsPDF Word.WdExportFormat wd = .WdExportFormat.wdExportFormatPDF Įxcel.XlFixedFormatType excelType = .XlFixedFormatType.xlTypePDF We can use bool to determine the format of generated files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |