C# 打开RTF文件时出现安全警告

C# 打开RTF文件时出现安全警告,c#,.net,rtf,word,C#,.net,Rtf,Word,我已经将多个RTF文件合并到一个RTF文件中,并保存了一个RTF文件。多个RTF文件中包含图像。我使用Interop.word Microsoft Office library将多个RTF文件合并到一个RTF文件中。当我尝试用写字板打开单个RTF文件时,它会显示一个安全警告,并要求“取消阻止”和“阻止”内容。单个RTF文件中包含图像。打开RTF文件时,它不信任RTF文件中的图像内容 我使用了这个Nuget软件包: Microsoft.Office.Interop.Word-版本15.0.4797

我已经将多个RTF文件合并到一个RTF文件中,并保存了一个RTF文件。多个RTF文件中包含图像。我使用Interop.word Microsoft Office library将多个RTF文件合并到一个RTF文件中。当我尝试用写字板打开单个RTF文件时,它会显示一个安全警告,并要求“取消阻止”和“阻止”内容。单个RTF文件中包含图像。打开RTF文件时,它不信任RTF文件中的图像内容

我使用了这个Nuget软件包:

Microsoft.Office.Interop.Word-版本15.0.4797.1003

public static void Merge(string[] filesToMerge, string outputFilename, bool insertPageBreaks)
{
object missing = System.Type.Missing;
object pageBreak = Microsoft.Office.Interop.Word.WdBreakType.wdSectionBreakNextPage;
object outputFile = outputFilename;
Microsoft.Office.Interop.Word._Application wordApplication = new Microsoft.Office.Interop.Word.Application();
try
{
Microsoft.Office.Interop.Word.Document wordDocument = wordApplication.Documents.Add(
ref missing
, ref missing
, ref missing
, ref missing);
Microsoft.Office.Interop.Word.Selection selection = wordApplication.Selection;
int documentCount = filesToMerge.Length;
int breakStop = 0;
foreach (string file in filesToMerge)
{
breakStop++;
selection.InsertFile(file, ref missing, ref missing, ref missing, ref missing);
if (insertPageBreaks && breakStop != documentCount)
{
selection.InsertBreak(ref pageBreak);
}
}
wordDocument.SaveAs(
ref outputFile
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing);
wordDocument = null;
}
catch (Exception ex)
{
throw ex;
}
finally
{
wordApplication.Quit(ref missing, ref missing, ref missing);
}
}