本文整理汇总了C#中Presentation类的典型用法代码示例。如果您正苦于以下问题:C# Presentation类的具体用法?C# Presentation怎么用?C# Presentation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Presentation类属于命名空间,在下文中一共展示了Presentation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
string FilePath = @"..\..\..\Sample Files\";
string srcFileName = FilePath + "User Defined Thumbnail.pptx";
string destFileName = FilePath + "User Defined Thumbnail.jpg";
//Instantiate a Presentation class that represents the presentation file
using (Presentation pres = new Presentation(srcFileName))
{
//Access the first slide
ISlide sld = pres.Slides[0];
//User defined dimension
int desiredX = 1200;
int desiredY = 800;
//Getting scaled value of X and Y
float ScaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX;
float ScaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY;
//Create a full scale image
Bitmap bmp = sld.GetThumbnail(ScaleX, ScaleY);
//Save the image to disk in JPEG format
bmp.Save(destFileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:29,代码来源:Program.cs
示例2: Import
public void Import(Presentation presentation, ResourceDescriptor[] resourceDescriptors,
DeviceResourceDescriptor[] deviceResourceDescriptors,
Func<Slide, Slide> addSlideDelegate, Func<IEnumerable<Slide>, bool> addLinkDelegate,
Func<string, string, bool> isSlideUniqueName,
int indent, int height)
{
_addSlideDelegate = addSlideDelegate;
_addLinkDelegate = addLinkDelegate;
_isSlideUniqueName = isSlideUniqueName;
string selectedFile = null;
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.RestoreDirectory = true;
openFileDialog.Filter = "XML Files (*.xml) | *.xml";
openFileDialog.Multiselect = false;
if (DialogResult.OK == openFileDialog.ShowDialog())
{
selectedFile = openFileDialog.FileName;
}
}
if (string.IsNullOrEmpty(selectedFile)) return;
ImportSlide importSlide = new ImportSlide(DesignerClient.Instance.StandalonePresentationWorker,
this);
importSlide.Import(selectedFile, presentation, resourceDescriptors, deviceResourceDescriptors, indent, height);
}
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:26,代码来源:ImportSlideController.cs
示例3: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Slides_Presentations_CRUD();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiate Presentation class that represents the presentation file
using (Presentation pres = new Presentation())
{
// Instantiate SlideCollection calss
ISlideCollection slds = pres.Slides;
for (int i = 0; i < pres.LayoutSlides.Count; i++)
{
// Add an empty slide to the Slides collection
slds.AddEmptySlide(pres.LayoutSlides[i]);
}
// Save the PPTX file to the Disk
pres.Save(dataDir + "EmptySlide_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:28,代码来源:AddSlides.cs
示例4: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Shapes();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiate Prseetation class that represents the PPTX
using (Presentation pres = new Presentation())
{
// Get the first slide
ISlide sld = pres.Slides[0];
// Add autoshape of ellipse type
IShape shp = sld.Shapes.AddAutoShape(ShapeType.Ellipse, 50, 150, 150, 50);
// Apply some formatting to ellipse shape
shp.FillFormat.FillType = FillType.Solid;
shp.FillFormat.SolidFillColor.Color = Color.Chocolate;
// Apply some formatting to the line of Ellipse
shp.LineFormat.FillFormat.FillType = FillType.Solid;
shp.LineFormat.FillFormat.SolidFillColor.Color = Color.Black;
shp.LineFormat.Width = 5;
//Write the PPTX file to disk
pres.Save(dataDir + "EllipseShp2_out.pptx", SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:35,代码来源:FormattedEllipse.cs
示例5: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Slides_Presentations_CRUD();
// Instantiate a Presentation class that represents the presentation file
using (Presentation pres = new Presentation(dataDir + "CreateSlidesSVGImage.pptx"))
{
// Access the first slide
ISlide sld = pres.Slides[0];
// Create a memory stream object
MemoryStream SvgStream = new MemoryStream();
// Generate SVG image of slide and save in memory stream
sld.WriteAsSvg(SvgStream);
SvgStream.Position = 0;
// Save memory stream to file
using (Stream fileStream = System.IO.File.OpenWrite(dataDir + "Aspose_out.svg"))
{
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = SvgStream.Read(buffer, 0, buffer.Length)) > 0)
{
fileStream.Write(buffer, 0, len);
}
}
SvgStream.Close();
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:34,代码来源:CreateSlidesSVGImage.cs
示例6: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Slides_Presentations_Background();
// Instantiate the Presentation class that represents the presentation file
using (Presentation pres = new Presentation(dataDir + "SetImageAsBackground.pptx"))
{
// Set the background with Image
pres.Slides[0].Background.Type = BackgroundType.OwnBackground;
pres.Slides[0].Background.FillFormat.FillType = FillType.Picture;
pres.Slides[0].Background.FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
// Set the picture
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(dataDir + "Tulips.jpg");
// Add image to presentation's images collection
IPPImage imgx = pres.Images.AddImage(img);
pres.Slides[0].Background.FillFormat.PictureFillFormat.Picture.Image = imgx;
// Write the presentation to disk
pres.Save(dataDir + "ContentBG_Img_out.pptx", SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:26,代码来源:SetImageAsBackground.cs
示例7: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Text();
// Instantiate Presentation class that represents PPTX// Instantiate Presentation class that represents PPTX
using (Presentation pres = new Presentation(dataDir + "ReplacingText.pptx"))
{
// Access first slide
ISlide sld = pres.Slides[0];
// Iterate through shapes to find the placeholder
foreach (IShape shp in sld.Shapes)
if (shp.Placeholder != null)
{
// Change the text of each placeholder
((IAutoShape)shp).TextFrame.Text = "This is Placeholder";
}
// Save the PPTX to Disk
pres.Save(dataDir + "output_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:25,代码来源:ReplacingText.cs
示例8: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Text();
// Create Empty presentation instance// Create Empty presentation instance
using (Presentation pres = new Presentation())
{
// Acesss the default first slide of presentation
ISlide slide = pres.Slides[0];
// Adding the AutoShape to accomodate the HTML content
IAutoShape ashape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, pres.SlideSize.Size.Width - 20, pres.SlideSize.Size.Height - 10);
ashape.FillFormat.FillType = FillType.NoFill;
// Adding text frame to the shape
ashape.AddTextFrame("");
// Clearing all paragraphs in added text frame
ashape.TextFrame.Paragraphs.Clear();
// Loading the HTML file using stream reader
TextReader tr = new StreamReader(dataDir + "file.html");
// Adding text from HTML stream reader in text frame
ashape.TextFrame.Paragraphs.AddFromHtml(tr.ReadToEnd());
// Saving Presentation
pres.Save(dataDir + "output_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:34,代码来源:ImportingHTMLText.cs
示例9: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Tables();
// Instantiate Presentation class that represents PPTX// Instantiate Presentation class that represents PPTX
using (Presentation presentation = new Presentation(dataDir + "UpdateExistingTable.pptx"))
{
// Access the first slide
ISlide sld = presentation.Slides[0];
// Initialize null TableEx
ITable table = null;
// Iterate through the shapes and set a reference to the table found
foreach (IShape shape in sld.Shapes)
if (shape is ITable)
table = (ITable)shape;
// Set the text of the first column of second row
table[0, 1].TextFrame.Text = "New";
// Write the PPTX to Disk
presentation.Save(dataDir + "UpdateTable_out.pptx", SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:26,代码来源:TableFromScratch.cs
示例10: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Presentations();
//Instanciate the Presentation class that represents the PPTX
Presentation pres = new Presentation(dataDir + "AccessModifyingProperties.pptx");
//Create a reference to DocumentProperties object associated with Prsentation
IDocumentProperties dp = pres.DocumentProperties;
//Access and modify custom properties
for (int i = 0; i < dp.Count; i++)
{
//Display names and values of custom properties
System.Console.WriteLine("Custom Property Name : " + dp.GetPropertyName(i));
System.Console.WriteLine("Custom Property Value : " + dp[dp.GetPropertyName(i)]);
//Modify values of custom properties
dp[dp.GetPropertyName(i)] = "New Value " + (i + 1);
}
//Save your presentation to a file
pres.Save(dataDir + "CustomDemoModified.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
开发者ID:nausherwan-aslam,项目名称:Aspose_Slides_NET,代码行数:25,代码来源:AccessModifyingProperties.cs
示例11: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Shapes();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiate PrseetationEx class that represents the PPTX
using (Presentation pres = new Presentation())
{
// Get the first slide
ISlide sld = pres.Slides[0];
// Add autoshape of rectangle type
IShape shp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 150, 75, 150);
// Rotate the shape to 90 degree
shp.Rotation = 90;
//Write the PPTX file to disk
pres.Save(dataDir + "RectShpRot_out.pptx", SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:27,代码来源:RotatingShapes.cs
示例12: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_VBA();
// ExStart:AddVBAMacros
// Instantiate Presentation
using (Presentation presentation = new Presentation())
{
// Create new VBA Project
presentation.VbaProject = new VbaProject();
// Add empty module to the VBA project
IVbaModule module = presentation.VbaProject.Modules.AddEmptyModule("Module");
// Set module source code
module.SourceCode = @"Sub Test(oShape As Shape) MsgBox ""Test"" End Sub";
// Create reference to <stdole>
VbaReferenceOleTypeLib stdoleReference =
new VbaReferenceOleTypeLib("stdole", "*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\\Windows\\system32\\stdole2.tlb#OLE Automation");
// Create reference to Office
VbaReferenceOleTypeLib officeReference =
new VbaReferenceOleTypeLib("Office", "*\\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE14\\MSO.DLL#Microsoft Office 14.0 Object Library");
// Add references to the VBA project
presentation.VbaProject.References.Add(stdoleReference);
presentation.VbaProject.References.Add(officeReference);
// ExStart:AddVBAMacros
// Save Presentation
presentation.Save(dataDir + "AddVBAMacros_out.pptm", SaveFormat.Pptm);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:35,代码来源:AddVBAMacros.cs
示例13: PptBuilder
public PptBuilder()
{
Presentations presentations = this.ppt.Presentations;
this.presentation = presentations.Add();
this.presentation.PageSetup.SlideSize = PpSlideSizeType.ppSlideSizeOnScreen16x10;
this.slides = this.presentation.Slides;
}
开发者ID:patricktoohey,项目名称:Tools,代码行数:7,代码来源:PptBuilder.cs
示例14: Run
public static void Run()
{
// ExStart:CheckSmartArtHiddenProperty
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_SmartArts();
using (Presentation presentation = new Presentation())
{
// Add SmartArt BasicProcess
ISmartArt smart = presentation.Slides[0].Shapes.AddSmartArt(10, 10, 400, 300, SmartArtLayoutType.RadialCycle);
// Add node on SmartArt
ISmartArtNode node = smart.AllNodes.AddNode();
// Check isHidden property
bool hidden = node.IsHidden; // Returns true
if (hidden)
{
// Do some actions or notifications
}
// ExEnd:CheckSmartArtHiddenProperty
// Saving Presentation
presentation.Save(dataDir + "CheckSmartArtHiddenProperty_out.pptx", SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:27,代码来源:CheckSmartArtHiddenProperty.cs
示例15: GetSlideTitles
// Get a list of the titles of all the slides in the presentation.
public static IList<string> GetSlideTitles(string presentationFile)
{
// Create a new linked list of strings.
List<string> texts = new List<string>();
//Instantiate PresentationEx class that represents PPTX
using (Presentation pres = new Presentation(presentationFile))
{
//Access all the slides
foreach (ISlide sld in pres.Slides)
{
//Iterate through shapes to find the placeholder
foreach (Shape shp in sld.Shapes)
if (shp.Placeholder != null)
{
if (IsTitleShape(shp))
{
//get the text of placeholder
texts.Add(((AutoShape)shp).TextFrame.Text);
}
}
}
}
// Return an array of strings.
return texts;
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:30,代码来源:Program.cs
示例16: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Shapes();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiate Prseetation class that represents the PPTX
using (Presentation pres = new Presentation())
{
// Get the first slide
ISlide sld = pres.Slides[0];
// Add autoshape of rectangle type
IShape shp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 150, 75, 150);
// Set the fill type to Pattern
shp.FillFormat.FillType = FillType.Pattern;
// Set the pattern style
shp.FillFormat.PatternFormat.PatternStyle = PatternStyle.Trellis;
// Set the pattern back and fore colors
shp.FillFormat.PatternFormat.BackColor.Color = Color.LightGray;
shp.FillFormat.PatternFormat.ForeColor.Color = Color.Yellow;
//Write the PPTX file to disk
pres.Save(dataDir + "RectShpPatt_out.pptx", SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:34,代码来源:FillShapesPattern.cs
示例17: ShowProperties
///<summary>Shows the JournalProperties form for a presentation, allowing the user to change the year.</summary>
public void ShowProperties(Presentation presentation)
{
if (presentation == null) throw new ArgumentNullException("presentation");
Program.Initialize();
using (var form = new Forms.JournalProperties(presentation)) {
var oldYear = form.JournalYear;
if (form.ShowDialog(presentation.Application.Window()) != DialogResult.OK) return;
if (oldYear == form.JournalYear) return;
openJournals.Remove(presentation);
if (form.JournalYear.HasValue) {
JournalPresentation.MakeJournal(presentation, form.JournalYear.Value);
var jp = RegisterJournal(presentation, createTaskPane: oldYear == null); //Only create a new taskpane if it wasn't already a journal
if (oldYear != null)
((AdPane)GetTaskPane(presentation).Control).ReplaceJournal(jp);
} else {
JournalPresentation.KillJournal(presentation);
UnregisterJournal(presentation);
}
//Force UI to invalidate
//presentation.Windows[1].ActivePane.ViewType = PpViewType.ppViewNormal;
presentation.Windows[1].View.GotoSlide(1);
((Slide)presentation.Windows[1].View.Slide).Shapes.SelectAll();
presentation.Windows[1].Selection.Unselect();
}
}
开发者ID:ShomreiTorah,项目名称:Journal,代码行数:30,代码来源:ThisAddIn.cs
示例18: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Conversion();
// Loading a presentation
using (Presentation pres = new Presentation(dataDir + "Media File.pptx"))
{
string path = dataDir;
const string fileName = "ExportMediaFiles_out.html";
const string baseUri = "http://www.example.com/";
VideoPlayerHtmlController controller = new VideoPlayerHtmlController(path, fileName, baseUri);
// Setting HTML options
HtmlOptions htmlOptions = new HtmlOptions(controller);
SVGOptions svgOptions = new SVGOptions(controller);
htmlOptions.HtmlFormatter = HtmlFormatter.CreateCustomFormatter(controller);
htmlOptions.SlideImageFormat = SlideImageFormat.Svg(svgOptions);
// Saving the file
pres.Save(Path.Combine(path, fileName), SaveFormat.Html, htmlOptions);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:25,代码来源:ExportMediaFilestohtml.cs
示例19: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Shapes();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiate PrseetationEx class that represents the PPTX
using (Presentation pres = new Presentation())
{
// Get the first slide
ISlide sld = pres.Slides[0];
// Add Video Frame
IVideoFrame vf = sld.Shapes.AddVideoFrame(50, 150, 300, 150, dataDir+ "video1.avi");
// Set Play Mode and Volume of the Video
vf.PlayMode = VideoPlayModePreset.Auto;
vf.Volume = AudioVolumeMode.Loud;
//Write the PPTX file to disk
pres.Save(dataDir + "VideoFrame_out.pptx", SaveFormat.Pptx);
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:31,代码来源:AddVideoFrame.cs
示例20: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Text();
// Load the presentation file
using (Presentation pres = new Presentation(dataDir + "ExportingHTMLText.pptx"))
{
// Acesss the default first slide of presentation
ISlide slide = pres.Slides[0];
// Desired index
int index = 0;
// Accessing the added shape
IAutoShape ashape = (IAutoShape)slide.Shapes[index];
// Extracting first paragraph as HTML
StreamWriter sw = new StreamWriter(dataDir + "output_out.html", false, Encoding.UTF8);
//Writing Paragraphs data to HTML by providing paragraph starting index, total paragraphs to be copied
sw.Write(ashape.TextFrame.Paragraphs.ExportToHtml(0, ashape.TextFrame.Paragraphs.Count, null));
sw.Close();
}
}
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:30,代码来源:ExportingHTMLText.cs
注:本文中的Presentation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论