编辑word文档,使所有段落之间只有一个空行

时间:2017-05-18 11:21:41

标签: c# visual-studio

我有一个带有几个段落的word文档和每个段落之间的空行随机数。我需要修改,以便所有段落之间只有一条空行我知道我想出了什么但它不起作用

using Microsoft.Office.Interop.Word;

namespace DataToPDF
{
    public class ParagraphLine
    {
        public static void RemoveLine()
        {
            object path = @"C:\Users\Desktop\Hey.docx";

            Application wordApp = new Application();

            object missing = System.Type.Missing;
            Document doc = wordApp.Documents.Open(ref path, 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);

            doc.Paragraphs.LineUnitAfter = 1;
        }
    }
}              

0 个答案:

没有答案