Last active
November 4, 2017 19:44
-
-
Save cpereira7/ef019e72fc50934d9dffe3b9dab77594 to your computer and use it in GitHub Desktop.
Guardar documentos docx em pdf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void ExportPDF(string nome) | |
| { | |
| var wordApp = new Microsoft.Office.Interop.Word.Application(); | |
| var wordDocument = wordApp.Documents.Open(nome); | |
| wordDocument.Save(); | |
| wordDocument.ExportAsFixedFormat(nome.Replace("docx", "pdf"), Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF); | |
| wordDocument.Close(Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges, | |
| Microsoft.Office.Interop.Word.WdOriginalFormat.wdOriginalDocumentFormat, | |
| false); | |
| wordApp.Quit(); | |
| Console.WriteLine(nome); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment