i'm trying to convert a .doc | .docx file into .pdf but the conversion is happening but i get this popup box is there anyway to avoid this
here is my code
Microsoft.Office.Interop.Word.Application wordapp = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document wordDoc = wordapp.Documents.Open(@"C:\\inetpub\\wwwroot\\WebSite1\\temp\\random.docx"); wordDoc.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection); wordDoc.ExportAsFixedFormat(@"C:\\inetpub\\wwwroot\\WebSite1\\temp\\random.pdf", Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF,false);
Microsoft.Office.Interop.Word.Application wordapp = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document wordDoc = wordapp.Documents.Open(@"C:\\inetpub\\wwwroot\\WebSite1\\temp\\random.docx"); wordDoc.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection); wordDoc.ExportAsFixedFormat(@"C:\\inetpub\\wwwroot\\WebSite1\\temp\\random.pdf", Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF,false);
Thanks all
You should forcibly open the word document as read-only...
Microsoft.Office.Interop.Word.Document wordDoc = wordapp.Documents.Open(@"C:\inetpub\wwwroot\WebSite1\temp\random.docx", ReadOnly:true);
See https://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.documents.open.aspx for other options that you may find additionally useful (such as not adding file to the recently used list)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.