如何在word文档中添加一个简单的短语
本文关键字:一个 简单 短语 word 文档 添加 | 更新日期: 2023-09-27 18:18:47
我用c#编程,我需要在每个ms-word文档的最后一页添加一个简单的短语。
i have try this
Word.Paragraph paragraph;
int totalPages;
Word.Range range;
range = doc.Content.Duplicate;
totalPages = range.ComputeStatistics(Word.WdStatistic.wdStatisticPages);
range = range.GoTo(Word.WdGoToItem.wdGoToPage, Type.Missing, totalPages, Type.Missing);
paragraph = doc.Paragraphs.Add(range);
paragraph.Range.Font.Name = "Arial";
paragraph.Range.Font.Size = 7;
paragraph.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
paragraph.Range.Text = encrypt;
但是这个代码在最后一页添加了一个短语
像这样如何(你可能需要修复c#语法):
doc.Content.InsertParagraphAfter();
Word.Paragraph paragraph = doc.Paragraphs(doc.Paragraphs.Count());
paragraph.Range.Font.Name = "Arial";
paragraph.Range.Font.Size = 7;
paragraph.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
paragraph.Range.Text = encrypt;