本文整理汇总了C#中Presentation.GetSlideByPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Presentation.GetSlideByPosition方法的具体用法?C# Presentation.GetSlideByPosition怎么用?C# Presentation.GetSlideByPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Presentation
的用法示例。
在下文中一共展示了Presentation.GetSlideByPosition方法的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");
}
示例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");
}
示例3: Main
static void Main(string[] args)
{
string path = @"Files\";
//Instantiate a Presentation object that represents a PPT file
Presentation pres = new Presentation(path + "RenderShapeAsImage.ppt");
//Accessing a slide using its slide position
Slide slide = pres.GetSlideByPosition(2);
//Iterate all shapes on a slide and create thumbnails
ShapeCollection shapes = slide.Shapes;
for (int i = 0; i < shapes.Count; i++)
{
Shape shape = shapes[i];
//Getting the thumbnail image of the shape
Image img = slide.GetThumbnail(new object[] { shape }, 1.0, 1.0,shape.ShapeRectangle);
//Saving the thumbnail image in gif format
img.Save(path + i + ".gif", ImageFormat.Gif);
}
}
示例4: 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");
}
示例5: 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");
}
示例6: PptConvertImagesInfo
/// <summary>
/// 将PPT转换成图片存放(插件:Aspose.Slides.dll)
/// </summary>
/// <param name="pptPath">源PPT文件路径</param>
/// <param name="imagePath">存放转换后的图片路径</param>
/// <returns>返回总共转换了多少张图片</returns>
public static int PptConvertImagesInfo(string pptPath, string imagePath)
{
var presentation = new Presentation(pptPath);
var endSliderCount = presentation.Slides.Count;
//循环导出所有的图片信息
for (int i = 0; i < endSliderCount + 1; i++)
{
Slide slide = presentation.GetSlideByPosition(i);
if (slide == null) continue;
using (var memoryStream = new MemoryStream())
{
slide.GetThumbnail(new Size(400, 400)).Save(imagePath + "/" + i + ".jpg");
}
}
return endSliderCount;
}