I am converting docs in a folder to PDF using the code below
string[] filePaths = Directory.GetFiles(txtFolderPath.Text, "*.doc",
SearchOption.TopDirectoryOnly);
foreach (string path in filePaths)
{
Application app = new Application();
app.DisplayAlerts = WdAlertLevel.wdAlertsNone;
app.Visible = true;
var objPresSet = app.Documents;
var objPres = objPresSet.Open(path, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
var temppath = path;
var pdfFileName = Path.ChangeExtension(path, ".pdf");
var pdfPath = Path.Combine(Path.GetDirectoryName(path), pdfFileName);
try
{
objPres.ExportAsFixedFormat(
pdfPath,
WdExportFormat.wdExportFormatPDF,
false,
WdExportOptimizeFor.wdExportOptimizeForPrint,
WdExportRange.wdExportAllDocument
);
}
catch
{
pdfPath = null;
}
finally
{
objPres.Close();
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
}
But for every document I am getting the pop up below eventhough I have set the alerts to none.
Since the number of files are huge how can I stop this alert programatically in C#.