using Microsoft.Office.Tools.Ribbon;
using MSWord = Microsoft.Office.Interop.Word;
namespace WordAddIn1
{
public partial class Ribbon1
{
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
}
private void button1_Click(object sender, RibbonControlEventArgs e)
{
//设置 纸型到 A3 字体为微软雅黑 页边距为窄
////Microsoft.Office.Interop.Word.Selection selection = Globals.ThisAddIn.Application.ActiveWindow.Selection;
MSWord.Document wordDoc = Globals.ThisAddIn.Application.ActiveWindow.Document;
wordDoc.PageSetup.PaperSize = MSWord.WdPaperSize.wdPaperA3;//设置纸张样式为A4纸
wordDoc.PageSetup.TopMargin = 41.27f;
wordDoc.PageSetup.BottomMargin = 41.27f;
wordDoc.PageSetup.LeftMargin = 41.27f;
wordDoc.PageSetup.RightMargin = 41.27f;
Globals.ThisAddIn.Application.ActiveWindow.Selection.Font.Name = "微软雅黑";
}
}
}
标签:插件,Word,41.27,wordDoc,Microsoft,Application,PageSetup From: https://www.cnblogs.com/hlm750908/p/16850716.html