当前位置: 首页>>代码示例>>C#>>正文


C# Presentation.Write方法代码示例

本文整理汇总了C#中Presentation.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Presentation.Write方法的具体用法?C# Presentation.Write怎么用?C# Presentation.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Presentation的用法示例。


在下文中一共展示了Presentation.Write方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            //Create a presentation
            Presentation pres = new Presentation();

            //Access first slide
            Slide sld = pres.GetSlideByPosition(1);

            //Add a table
            Aspose.Slides.Table tbl = sld.Shapes.AddTable(50, 50, pres.SlideSize.Width - 100, pres.SlideSize.Height - 100, 15, 15);

            //Loop through rows
            for (int i = 0; i < tbl.RowsNumber; i++)
                //Loop through cells
                for (int j = 0; j < tbl.ColumnsNumber; j++)
                {
                    //Get text frame of each cell
                    TextFrame tf = tbl.GetCell(j, i).TextFrame;
                    //Add some text
                    tf.Text = "T" + i.ToString() + j.ToString();
                    //Set font size of 10
                    tf.Paragraphs[0].Portions[0].FontHeight = 10;
                    tf.Paragraphs[0].HasBullet = false;
                }

            //Write the presentation to the disk
            pres.Write("tblSLD.ppt");
        }
开发者ID:horazius17,项目名称:Aspose_Slides_NET,代码行数:28,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            //Create a presentation
            Presentation pres = new Presentation();

            //Blank slide is added by default, when you create
            //presentation from default constructor
            //So, we don't need to add any blank slide
            Slide sld = pres.GetSlideByPosition(1);

            //Get the font index for Arial
            //It is always 0 if you create presentation from
            //default constructor
            int arialFontIndex = 0;

            //Add a textbox
            //To add it, we will first add a rectangle
            Shape shp = sld.Shapes.AddRectangle(1200, 800, 3200, 370);

            //Hide its line
            shp.LineFormat.ShowLines = false;

            //Then add a textframe inside it
            TextFrame tf = shp.AddTextFrame("");

            //Set a text
            tf.Text = "Text added dynamically";
            Portion port = tf.Paragraphs[0].Portions[0];
            port.FontIndex = arialFontIndex;
            port.FontBold = true;
            port.FontHeight = 32;

            //Write the output to disk
            pres.Write("outAspose.ppt");
        }
开发者ID:horazius17,项目名称:Aspose_Slides_NET,代码行数:35,代码来源:Program.cs

示例3: Main

        static void Main(string[] args)
        {
            //Create a presentation
            Presentation pres = new Presentation();

            //Add the title slide
            Slide slide = pres.AddTitleSlide();

            //Set the title text
            ((TextHolder)slide.Placeholders[0]).Text = "Slide Title Heading";

            //Set the sub title text
            ((TextHolder)slide.Placeholders[1]).Text = "Slide Title Sub-Heading";

            //Write output to disk
            pres.Write("outAsposeSlides.ppt");
        }
开发者ID:horazius17,项目名称:Aspose_Slides_NET,代码行数:17,代码来源:Program.cs

示例4: findReplaceText

 private static void findReplaceText(string strToFind, string strToReplaceWith)
 {
     //Open the presentation
     Presentation pres = new Presentation("mytextone.ppt");
     //Get all text boxes in the presentation
     ITextBox[] tb = PresentationScanner.GetAllTextBoxes(pres, false);
     for (int i = 0; i < tb.Length; i++)
         foreach (Paragraph para in tb[i].Paragraphs)
             foreach (Portion port in para.Portions)
                 //Find text to be replaced
                 if (port.Text.Contains(strToFind))
                 //Replace exisitng text with the new text
                 {
                     string str = port.Text;
                     int idx = str.IndexOf(strToFind);
                     string strStartText = str.Substring(0, idx);
                     string strEndText = str.Substring(idx + strToFind.Length, str.Length - 1 - (idx + strToFind.Length - 1));
                     port.Text = strStartText + strToReplaceWith + strEndText;
                 }
     pres.Write("myTextOneAspose.ppt");
 }
开发者ID:horazius17,项目名称:Aspose_Slides_NET,代码行数:21,代码来源:Program.cs

示例5: Main

        static void Main(string[] args)
        {
            //Open the presentation
            Presentation pres = new Presentation("source.ppt");

            //Add Verdana font
            FontEntity font = pres.Fonts[0];
            FontEntity verdanaFont = new FontEntity(pres, font);
            verdanaFont.FontName = "Verdana";
            int verdanaFontIndex = pres.Fonts.Add(verdanaFont);

            //Access the first slide
            Slide slide = pres.GetSlideByPosition(1);

            //Access the third shape
            Shape shp = slide.Shapes[2];

            //Change its text's font to Verdana and height to 32
            TextFrame tf = shp.TextFrame;
            Paragraph para = tf.Paragraphs[0];
            Portion port = para.Portions[0];
            port.FontIndex = verdanaFontIndex;
            port.FontHeight = 32;

            //Bolden it
            port.FontBold = true;

            //Italicize it
            port.FontItalic = true;

            //Change text color
            port.FontColor = Color.FromArgb(0x33, 0x33, 0xCC);

            //Change shape background color
            shp.FillFormat.Type = FillType.Solid;
            shp.FillFormat.ForeColor = Color.FromArgb(0xCC, 0xCC, 0xFF);

            //Write the output to disk
            pres.Write("outAspose.ppt");
        }
开发者ID:horazius17,项目名称:Aspose_Slides_NET,代码行数:40,代码来源:Program.cs

示例6: Main

        static void Main(string[] args)
        {
            //Instantiate PresentationEx class that represents the PPT file
            Presentation pres = new Presentation();

            //Blank slide is added by default, when you create
            //presentation from default constructor
            //Adding an empty slide to the presentation and getting the reference of
            //that empty slide
            Slide slide = pres.AddEmptySlide();

            slide = pres.GetSlideByPosition(2);

            //Get the font index for Arial
            //It is always 0 if you create presentation from
            //default constructor
            int arialFontIndex = 0;

            //Add a textbox
            //To add it, we will first add a rectangle
            Shape shp = slide.Shapes.AddRectangle(1200, 800, 3200, 370);

            //Hide its line
            shp.LineFormat.ShowLines = false;

            //Then add a textframe inside it
            TextFrame tf = shp.AddTextFrame("");

            //Set a text
            tf.Text = "Text added dynamically";
            Portion port = tf.Paragraphs[0].Portions[0];
            port.FontIndex = arialFontIndex;
            port.FontBold = true;
            port.FontHeight = 32;

            //Write the output to disk
            pres.Write("outAspose.ppt");
        }
开发者ID:horazius17,项目名称:Aspose_Slides_NET,代码行数:38,代码来源:Program.cs


注:本文中的Presentation.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。