我们如何在 .Net 中使用 aspose.words 为 word 文档设置页边距

How can we set page margins for word document using aspose.words in .Net

我在 .Net 中使用 Aspose.Words,我需要使用 Aspose.Words 设置每边的页边距、页面方向和页眉页脚距离?

您可以通过不同的方式为 Word 文档设置页边距。但下面是最简单的方法:

            Document() doc = new Document();

            DocumentBuilder(doc) builder = new DocumentBuilder(doc)
            {
                PageSetup =
                {
                    Orientation = Word.Orientation.Portrait,
                    PaperSize = Word.PaperSize.Letter,
                    LeftMargin = 72.0,
                    RightMargin = 72.0,
                    TopMargin = 72.0,
                    BottomMargin = 72.0
                },

            };