大众计算机学习网欢迎诸位!收藏本站注 册登 陆
常用教程:基础知识网络知识操作系统WPS网页制作数据库算法网页成功之路网络安全最新技术古典mid流行midmid背景下载中心
您现在的位置:首页 > 教程 > 文章页

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

Admin | 2016-2-26 17:45:23 | ReadNums | 1941 | 标签 asp.net | 打印本页
      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;
           

问题未解决:在线咨询我要在线咨询问题

网友评论

(访客)
内容实用原创,讲得很好。
20xx年x月x日
(站长)
有问题请在线咨询。
20xx年x月x日