Dzwebs.Net

撰写电脑技术杂文十余年

aspose.word设置纸张的功能代码

Admin | 2016-2-26 17:45:23 | 被阅次数 | 7910

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆
public void setPaperSize(string papersize)
        {
            switch (papersize)
            {
                case "A4":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A4;
                        section.PageSetup.Orientation = Orientation.Portrait;
                        section.PageSetup.VerticalAlignment = Aspose.Words.PageVerticalAlignment.Top;
                    }
                    break;
                case "A4H":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A4;
                        section.PageSetup.Orientation = Orientation.Landscape;
                        section.PageSetup.TextColumns.SetCount(2);
                        section.PageSetup.TextColumns.EvenlySpaced = true;
                        section.PageSetup.TextColumns.LineBetween =true;
                    }
                    break;
                case "A3":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A3;
                        section.PageSetup.Orientation = Orientation.Portrait;    
                    }
                    break;
                case "A3H":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A3;
                        section.PageSetup.Orientation = Orientation.Landscape;
                        section.PageSetup.TextColumns.SetCount(2);
                        section.PageSetup.TextColumns.EvenlySpaced = true;
                        section.PageSetup.TextColumns.LineBetween = true;
                    }
                    break;
                case "16K":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.B5;
                        section.PageSetup.Orientation = Orientation.Portrait;
                    }
                    break;
                case "8KH":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PageWidth = double.Parse("36.4 ");
                        section.PageSetup.PageHeight = double.Parse("25.7");
                        section.PageSetup.Orientation = Orientation.Landscape;
           

该杂文来自: 网站开发杂文

上一篇:利用Aspose.Words从文档中提取图像的代码

下一篇:aspose.word设置字体字号对齐方式

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计