大众计算机学习网

专门提供各种电脑教程

aspose.words设置纸型的代码上篇

Admin | 2015-8-25 10:17:33 | 被阅次数 | 2695

  下面代码是通过ASP.NET调用ASPOSE.WORDS设置word纸张,即页面设置里面选择纸型的代码。

  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"://A4横向 
                    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; 
                        //section.PageSetup.LeftMargin = double.Parse("3.35"); 
                        //section.PageSetup.RightMargin =double.Parse("0.99"); 
                    } 
                    break; 
                case "A3": 
                    foreach (Aspose.Words.Section section in oDoc) 
                    { 
                        section.PageSetup.PaperSize = PaperSize.A3; 
                        section.PageSetup.Orientation = Orientation.Portrait; 
                        
                    } 
                    
                    break; 
  接下篇…