From c99ff5a34427fa938f70ceadd407767ec061c11f Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Wed, 26 Mar 2025 14:19:50 +0000 Subject: [PATCH 01/21] added c#/vb code --- ...dd-a-video-to-a-slide-in-a-presentation.md | 167 ++++++++++++++++++ samples/presentation/add_video/cs/Program.cs | 143 +++++++++++++++ .../add_video/cs/add_video_cs.csproj | 10 ++ samples/presentation/add_video/vb/Program.vb | 162 +++++++++++++++++ .../add_video/vb/add_video_vb.vbproj | 9 + .../cs/insert_a_new_slideto_cs.csproj | 6 +- samples/samples.sln | 14 ++ 7 files changed, 510 insertions(+), 1 deletion(-) create mode 100644 docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md create mode 100644 samples/presentation/add_video/cs/Program.cs create mode 100644 samples/presentation/add_video/cs/add_video_cs.csproj create mode 100644 samples/presentation/add_video/vb/Program.vb create mode 100644 samples/presentation/add_video/vb/add_video_vb.vbproj diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md new file mode 100644 index 00000000..c705c3e1 --- /dev/null +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -0,0 +1,167 @@ +--- + +api_name: +- Microsoft.Office.DocumentFormat.OpenXML.Packaging +api_type: +- schema +ms.assetid: 403abe97-7ab2-40ba-92c0-d6312a6d10c8 +title: 'How to: Add a video to a slide in a presentation' +ms.suite: office + +ms.author: o365devx +author: o365devx +ms.topic: conceptual +ms.date: 02/25/2025 +ms.localizationpriority: medium +--- + +# Add a video to a slide in a presentation + +This topic shows how to use the classes in the Open XML SDK for +Office to add a video to the first slide in a presentation +programmatically. + +## Getting a Presentation Object + +In the Open XML SDK, the `PresentationDocument` class represents a +presentation document package. To work with a presentation document, +first create an instance of the `PresentationDocument` class, and then work with +that instance. To create the class instance from the document call the +`Open` method that uses a file path, and a +Boolean value as the second parameter to specify whether a document is +editable. To open a document for read/write, specify the value `true` for this parameter as shown in the following +`using` statement. In this code, the file +parameter is a string that represents the path for the file from which +you want to open the document. + +### [C#](#tab/cs-1) +[!code-csharp[](../../samples/presentation/add_video/cs/Program.cs#snippet1)] + +### [Visual Basic](#tab/vb-1) +[!code-vb[](../../samples/presentation/add_video/vb/Program.vb#snippet1)] +*** + + +[!include[Using Statement](../includes/presentation/using-statement.md)] `ppt`. + + +## The Structure of the Video From File + +The basic document structure of a PresentationML document consists of a +number of parts, among which is the Shape Tree (``) element. + +The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification +introduces the overall form of a `PresentationML` package. + +> This element specifies the presence of a video file. It is defined +> within the non-visual properties of an object. The video is attached to an object, representing it +> shall be attached to an object as this is how it is represented within +> the document. The actual playing of the video however is done within +> the timing node list that is specified under the timing element. +> +> [*Example*: Consider the following ``Picture`` object that has a video attached to it. + +```xml + + + + + .. + + + .. + + + .. + + + + .. + +``` + +> In the above example the shape tree specifies all the shape properties +> for this slide. *end example*] +> +> © [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)] + +The following table lists the child elements of the Shape Tree along +with the description of each. + +| Element | Description | +|---|---| +| cxnSp | Connection Shape | +| extLst | Extension List with Modification Flag | +| graphicFrame | Graphic Frame | +| grpSp | Group Shape | +| grpSpPr | Group Shape Properties | +| nvGrpSpPr | Non-Visual Properties for a Group Shape | +| pic | Picture | +| sp | Shape | + +The following XML Schema fragment defines the contents of this element. + +```xml + + + + + + + + + + + + + + +``` + +## How the Sample Code Works + +After opening the presentation file for read/write access in the `using` statement, the code gets the presentation +part from the presentation document. Then it gets the relationship ID of +the first slide, and gets the slide part from the relationship ID. + +> [!NOTE] +> The test file must have a shape on the first slide. + +### [C#](#tab/cs-2) +[!code-csharp[](../../samples/presentation/change_the_fill_color_of_a_shape/cs/Program.cs#snippet2)] + +### [Visual Basic](#tab/vb-2) +[!code-vb[](../../samples/presentation/change_the_fill_color_of_a_shape/vb/Program.vb#snippet2)] +*** + + +The code then gets the shape tree that contains the shape whose fill +color is to be changed, and gets the first shape in the shape tree. It +then gets the shape properties of the shape and the solid fill reference of the shape properties, +and assigns a new fill color to the shape. There is no need to explicitly +save the file when inside of a using. + +### [C#](#tab/cs-3) +[!code-csharp[](../../samples/presentation/change_the_fill_color_of_a_shape/cs/Program.cs#snippet3)] + +### [Visual Basic](#tab/vb-3) +[!code-vb[](../../samples/presentation/change_the_fill_color_of_a_shape/vb/Program.vb#snippet3)] +*** + + +## Sample Code + +Following is the complete sample code that you can use to change the +fill color of a shape in a presentation. +### [C#](#tab/cs) +[!code-csharp[](../../samples/presentation/change_the_fill_color_of_a_shape/cs/Program.cs#snippet0)] + +### [Visual Basic](#tab/vb) +[!code-vb[](../../samples/presentation/change_the_fill_color_of_a_shape/vb/Program.vb#snippet0)] +*** + +## See also + + + +- [Open XML SDK class library reference](/office/open-xml/open-xml-sdk) diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs new file mode 100644 index 00000000..29dd7c71 --- /dev/null +++ b/samples/presentation/add_video/cs/Program.cs @@ -0,0 +1,143 @@ +using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Presentation; +using A = DocumentFormat.OpenXml.Drawing; +using P14 = DocumentFormat.OpenXml.Office2010.PowerPoint; +using ShapeTree = DocumentFormat.OpenXml.Presentation.ShapeTree; +using ShapeProperties = DocumentFormat.OpenXml.Presentation.ShapeProperties; +using NonVisualDrawingProperties = DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties; +using NonVisualPictureProperties = DocumentFormat.OpenXml.Presentation.NonVisualPictureProperties; +using NonVisualPictureDrawingProperties = DocumentFormat.OpenXml.Presentation.NonVisualPictureDrawingProperties; +using Picture = DocumentFormat.OpenXml.Presentation.Picture; +using BlipFill = DocumentFormat.OpenXml.Presentation.BlipFill; +using DocumentFormat.OpenXml.Packaging; +using ApplicationNonVisualDrawingProperties = DocumentFormat.OpenXml.Presentation.ApplicationNonVisualDrawingProperties; + + +AddVideo(args[0], args[1], args[2]); + +static void AddVideo(string filePath, string videoFilePath, string coverPicPath) +{ + + string imgEmbedId = "rId4", embedId = "rId3", mediaEmbedId = "rId2"; + UInt32Value shapeId = 5; + // + using (PresentationDocument presentationDocument = PresentationDocument.Open(filePath, true)) + // + { + + if (presentationDocument.PresentationPart == null || presentationDocument.PresentationPart.Presentation.SlideIdList == null) + { + throw new NullReferenceException("Presenation Part is empty or there are no slides in it"); + } + + //Get presentation part + PresentationPart presentationPart = presentationDocument.PresentationPart; + + //Get slides ids. + OpenXmlElementList slidesIds = presentationPart.Presentation.SlideIdList.ChildElements; + + + //Get relationsipId of the last slide + string? videoSldRelationshipId = ((SlideId) slidesIds[0]).RelationshipId; + + if (videoSldRelationshipId == null) + { + throw new NullReferenceException("Slide id not found"); + } + + //Get slide part by relationshipID + SlidePart? slidePart = (SlidePart) presentationPart.GetPartById(videoSldRelationshipId); + + // Create video Media Data Part (content type, extension) + MediaDataPart mediaDataPart = presentationDocument.CreateMediaDataPart("video/mp4", ".mp4"); + + //Get the video file and feed the stream + using (Stream mediaDataPartStream = File.OpenRead(videoFilePath)) + { + mediaDataPart.FeedData(mediaDataPartStream); + } + //Adds a VideoReferenceRelationship to the MainDocumentPart + slidePart.AddVideoReferenceRelationship(mediaDataPart, embedId); + + //Adds a MediaReferenceRelationship to the SlideLayoutPart + slidePart.AddMediaReferenceRelationship(mediaDataPart, mediaEmbedId); + + NonVisualDrawingProperties nonVisualDrawingProperties = new NonVisualDrawingProperties() { Id = shapeId, Name = "video" }; + A.VideoFromFile videoFromFile = new A.VideoFromFile() { Link = embedId }; + + ApplicationNonVisualDrawingProperties appNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties(); + appNonVisualDrawingProperties.Append(videoFromFile); + + //adds sample image to the slide with id to be used as reference in blip + ImagePart imagePart = slidePart.AddImagePart(ImagePartType.Png, imgEmbedId); + using (Stream data = File.OpenRead(coverPicPath)) + { + imagePart.FeedData(data); + } + + if (slidePart!.Slide!.CommonSlideData!.ShapeTree == null) + { + throw new NullReferenceException("Presenation shape tree is empty"); + } + + //Getting existing shape tree object from PowerPoint + ShapeTree shapeTree = slidePart.Slide.CommonSlideData.ShapeTree; + + // specifies the existence of a picture within a presentation. + // It can have non-visual properties, a picture fill as well as shape properties attached to it. + Picture picture = new Picture(); + NonVisualPictureProperties nonVisualPictureProperties = new NonVisualPictureProperties(); + + A.HyperlinkOnClick hyperlinkOnClick = new A.HyperlinkOnClick() { Id = "", Action = "ppaction://media" }; + nonVisualDrawingProperties.Append(hyperlinkOnClick); + + NonVisualPictureDrawingProperties nonVisualPictureDrawingProperties = new NonVisualPictureDrawingProperties(); + A.PictureLocks pictureLocks = new A.PictureLocks() { NoChangeAspect = true }; + nonVisualPictureDrawingProperties.Append(pictureLocks); + + ApplicationNonVisualDrawingPropertiesExtensionList appNonVisualDrawingPropertiesExtensionList = new ApplicationNonVisualDrawingPropertiesExtensionList(); + ApplicationNonVisualDrawingPropertiesExtension appNonVisualDrawingPropertiesExtension = new ApplicationNonVisualDrawingPropertiesExtension() { Uri = "{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}" }; + + P14.Media media = new() { Embed = mediaEmbedId }; + media.AddNamespaceDeclaration("p14", "http://schemas.microsoft.com/office/powerpoint/2010/main"); + + appNonVisualDrawingPropertiesExtension.Append(media); + appNonVisualDrawingPropertiesExtensionList.Append(appNonVisualDrawingPropertiesExtension); + appNonVisualDrawingProperties.Append(appNonVisualDrawingPropertiesExtensionList); + + nonVisualPictureProperties.Append(nonVisualDrawingProperties); + nonVisualPictureProperties.Append(nonVisualPictureDrawingProperties); + nonVisualPictureProperties.Append(appNonVisualDrawingProperties); + + //Prepare shape properties to display picture + BlipFill blipFill = new BlipFill(); + A.Blip blip = new A.Blip() { Embed = imgEmbedId }; + + A.Stretch stretch = new A.Stretch(); + A.FillRectangle fillRectangle = new A.FillRectangle(); + A.Transform2D transform2D = new A.Transform2D(); + A.Offset offset = new A.Offset() { X = 1524000L, Y = 857250L }; + A.Extents extents = new A.Extents() { Cx = 9144000L, Cy = 5143500L }; + A.PresetGeometry presetGeometry = new A.PresetGeometry() { Preset = A.ShapeTypeValues.Rectangle }; + A.AdjustValueList adjValueList = new A.AdjustValueList(); + + stretch.Append(fillRectangle); + blipFill.Append(blip); + blipFill.Append(stretch); + transform2D.Append(offset); + transform2D.Append(extents); + presetGeometry.Append(adjValueList); + + ShapeProperties shapeProperties = new ShapeProperties(); + shapeProperties.Append(transform2D); + shapeProperties.Append(presetGeometry); + + //adds all elements to the slide's shape tree + picture.Append(nonVisualPictureProperties); + picture.Append(blipFill); + picture.Append(shapeProperties); + + shapeTree.Append(picture); + + } +} \ No newline at end of file diff --git a/samples/presentation/add_video/cs/add_video_cs.csproj b/samples/presentation/add_video/cs/add_video_cs.csproj new file mode 100644 index 00000000..fd4bd08d --- /dev/null +++ b/samples/presentation/add_video/cs/add_video_cs.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + + diff --git a/samples/presentation/add_video/vb/Program.vb b/samples/presentation/add_video/vb/Program.vb new file mode 100644 index 00000000..5d2574db --- /dev/null +++ b/samples/presentation/add_video/vb/Program.vb @@ -0,0 +1,162 @@ +Imports DocumentFormat.OpenXml +Imports DocumentFormat.OpenXml.Presentation +Imports A = DocumentFormat.OpenXml.Drawing +Imports P14 = DocumentFormat.OpenXml.Office2010.PowerPoint +Imports ShapeTree = DocumentFormat.OpenXml.Presentation.ShapeTree +Imports ShapeProperties = DocumentFormat.OpenXml.Presentation.ShapeProperties +Imports NonVisualDrawingProperties = DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties +Imports NonVisualPictureProperties = DocumentFormat.OpenXml.Presentation.NonVisualPictureProperties +Imports NonVisualPictureDrawingProperties = DocumentFormat.OpenXml.Presentation.NonVisualPictureDrawingProperties +Imports Picture = DocumentFormat.OpenXml.Presentation.Picture +Imports BlipFill = DocumentFormat.OpenXml.Presentation.BlipFill +Imports DocumentFormat.OpenXml.Packaging +Imports ApplicationNonVisualDrawingProperties = DocumentFormat.OpenXml.Presentation.ApplicationNonVisualDrawingProperties +Imports System.IO + +Module Program + Sub Main(args As String()) + AddVideo(args(0), args(1), args(2)) + End Sub + + Sub AddVideo(filePath As String, videoFilePath As String, coverPicPath As String) + Dim imgEmbedId As String = "rId4" + Dim embedId As String = "rId3" + Dim mediaEmbedId As String = "rId2" + Dim shapeId As UInt32Value = 5 + ' + Using presentationDocument As PresentationDocument = PresentationDocument.Open(filePath, True) + ' + If presentationDocument.PresentationPart Is Nothing OrElse presentationDocument.PresentationPart.Presentation.SlideIdList Is Nothing Then + Throw New NullReferenceException("Presentation Part is empty or there are no slides in it") + End If + + ' Get presentation part + Dim presentationPart As PresentationPart = presentationDocument.PresentationPart + + ' Get slides ids + Dim slidesIds As OpenXmlElementList = presentationPart.Presentation.SlideIdList.ChildElements + + ' Get relationshipId of the last slide + Dim videoSldRelationshipId As String = CType(slidesIds(0), SlideId).RelationshipId + + If videoSldRelationshipId Is Nothing Then + Throw New NullReferenceException("Slide id not found") + End If + + ' Get slide part by relationshipID + Dim slidePart As SlidePart = CType(presentationPart.GetPartById(videoSldRelationshipId), SlidePart) + + ' Create video Media Data Part (content type, extension) + Dim mediaDataPart As MediaDataPart = presentationDocument.CreateMediaDataPart("video/mp4", ".mp4") + + ' Get the video file and feed the stream + Using mediaDataPartStream As Stream = File.OpenRead(videoFilePath) + mediaDataPart.FeedData(mediaDataPartStream) + End Using + + ' Adds a VideoReferenceRelationship to the MainDocumentPart + slidePart.AddVideoReferenceRelationship(mediaDataPart, embedId) + + ' Adds a MediaReferenceRelationship to the SlideLayoutPart + slidePart.AddMediaReferenceRelationship(mediaDataPart, mediaEmbedId) + + Dim nonVisualDrawingProperties As New NonVisualDrawingProperties() With { + .Id = shapeId, + .Name = "video" + } + Dim videoFromFile As New A.VideoFromFile() With { + .Link = embedId + } + + Dim appNonVisualDrawingProperties As New ApplicationNonVisualDrawingProperties() + appNonVisualDrawingProperties.Append(videoFromFile) + + ' Adds sample image to the slide with id to be used as reference in blip + Dim imagePart As ImagePart = slidePart.AddImagePart(ImagePartType.Png, imgEmbedId) + Using data As Stream = File.OpenRead(coverPicPath) + imagePart.FeedData(data) + End Using + + If slidePart.Slide.CommonSlideData.ShapeTree Is Nothing Then + Throw New NullReferenceException("Presentation shape tree is empty") + End If + + ' Getting existing shape tree object from PowerPoint + Dim shapeTree As ShapeTree = slidePart.Slide.CommonSlideData.ShapeTree + + ' Specifies the existence of a picture within a presentation + Dim picture As New Picture() + Dim nonVisualPictureProperties As New NonVisualPictureProperties() + + Dim hyperlinkOnClick As New A.HyperlinkOnClick() With { + .Id = "", + .Action = "ppaction://media" + } + nonVisualDrawingProperties.Append(hyperlinkOnClick) + + Dim nonVisualPictureDrawingProperties As New NonVisualPictureDrawingProperties() + Dim pictureLocks As New A.PictureLocks() With { + .NoChangeAspect = True + } + nonVisualPictureDrawingProperties.Append(pictureLocks) + + Dim appNonVisualDrawingPropertiesExtensionList As New ApplicationNonVisualDrawingPropertiesExtensionList() + Dim appNonVisualDrawingPropertiesExtension As New ApplicationNonVisualDrawingPropertiesExtension() With { + .Uri = "{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}" + } + + Dim media As New P14.Media() With { + .Embed = mediaEmbedId + } + media.AddNamespaceDeclaration("p14", "http://schemas.microsoft.com/office/powerpoint/2010/main") + + appNonVisualDrawingPropertiesExtension.Append(media) + appNonVisualDrawingPropertiesExtensionList.Append(appNonVisualDrawingPropertiesExtension) + appNonVisualDrawingProperties.Append(appNonVisualDrawingPropertiesExtensionList) + + nonVisualPictureProperties.Append(nonVisualDrawingProperties) + nonVisualPictureProperties.Append(nonVisualPictureDrawingProperties) + nonVisualPictureProperties.Append(appNonVisualDrawingProperties) + + ' Prepare shape properties to display picture + Dim blipFill As New BlipFill() + Dim blip As New A.Blip() With { + .Embed = imgEmbedId + } + + Dim stretch As New A.Stretch() + Dim fillRectangle As New A.FillRectangle() + Dim transform2D As New A.Transform2D() + Dim offset As New A.Offset() With { + .X = 1524000L, + .Y = 857250L + } + Dim extents As New A.Extents() With { + .Cx = 9144000L, + .Cy = 5143500L + } + Dim presetGeometry As New A.PresetGeometry() With { + .Preset = A.ShapeTypeValues.Rectangle + } + Dim adjValueList As New A.AdjustValueList() + + stretch.Append(fillRectangle) + blipFill.Append(blip) + blipFill.Append(stretch) + transform2D.Append(offset) + transform2D.Append(extents) + presetGeometry.Append(adjValueList) + + Dim shapeProperties As New ShapeProperties() + shapeProperties.Append(transform2D) + shapeProperties.Append(presetGeometry) + + ' Adds all elements to the slide's shape tree + picture.Append(nonVisualPictureProperties) + picture.Append(blipFill) + picture.Append(shapeProperties) + + shapeTree.Append(picture) + End Using + End Sub +End Module \ No newline at end of file diff --git a/samples/presentation/add_video/vb/add_video_vb.vbproj b/samples/presentation/add_video/vb/add_video_vb.vbproj new file mode 100644 index 00000000..9edc3769 --- /dev/null +++ b/samples/presentation/add_video/vb/add_video_vb.vbproj @@ -0,0 +1,9 @@ + + + + Exe + add_video_vb + net9.0 + + + diff --git a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj index b4b1d3ea..08847b93 100644 --- a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj +++ b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj @@ -1 +1,5 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/samples/samples.sln b/samples/samples.sln index 79c210a2..79cc1e37 100644 --- a/samples/samples.sln +++ b/samples/samples.sln @@ -320,6 +320,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "working_with_tables_vb", "w EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "insert_a_picture_vb", "word\insert_a_picture\vb\insert_a_picture_vb.vbproj", "{6170C4E1-A109-435A-BF59-026C85B3BD9C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "add_video_cs", "presentation\add_video\cs\add_video_cs.csproj", "{9350E344-D11D-4496-9092-9BA18FC65175}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "add_video_vb", "presentation\add_video\vb\add_video_vb.vbproj", "{437E22AF-37F2-4D91-B508-2317AD5368BE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -938,6 +942,14 @@ Global {6170C4E1-A109-435A-BF59-026C85B3BD9C}.Debug|Any CPU.Build.0 = Debug|Any CPU {6170C4E1-A109-435A-BF59-026C85B3BD9C}.Release|Any CPU.ActiveCfg = Release|Any CPU {6170C4E1-A109-435A-BF59-026C85B3BD9C}.Release|Any CPU.Build.0 = Release|Any CPU + {9350E344-D11D-4496-9092-9BA18FC65175}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9350E344-D11D-4496-9092-9BA18FC65175}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9350E344-D11D-4496-9092-9BA18FC65175}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9350E344-D11D-4496-9092-9BA18FC65175}.Release|Any CPU.Build.0 = Release|Any CPU + {437E22AF-37F2-4D91-B508-2317AD5368BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {437E22AF-37F2-4D91-B508-2317AD5368BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {437E22AF-37F2-4D91-B508-2317AD5368BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {437E22AF-37F2-4D91-B508-2317AD5368BE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1095,6 +1107,8 @@ Global {A43A75AB-D6B6-4D31-99F7-6951AFEF502D} = {D207D3D7-FD4D-4FD4-A7D0-79A82086FB6F} {4EB1FCC9-E1E2-4D2A-ACF9-A3A31AA947A5} = {D207D3D7-FD4D-4FD4-A7D0-79A82086FB6F} {6170C4E1-A109-435A-BF59-026C85B3BD9C} = {D207D3D7-FD4D-4FD4-A7D0-79A82086FB6F} + {9350E344-D11D-4496-9092-9BA18FC65175} = {CDB9D4A6-7A7A-4CDF-A7A3-4F17F5F1602D} + {437E22AF-37F2-4D91-B508-2317AD5368BE} = {CDB9D4A6-7A7A-4CDF-A7A3-4F17F5F1602D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {721B3030-08D7-4412-9087-D1CFBB3F5046} From 798e91fd1ea2f8841bb05dda6bec801cebec915f Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Fri, 28 Mar 2025 09:31:50 +0000 Subject: [PATCH 02/21] added code snipets --- ...dd-a-video-to-a-slide-in-a-presentation.md | 125 +++++++----------- samples/presentation/add_video/cs/Program.cs | 18 ++- samples/presentation/add_video/vb/Program.vb | 17 ++- 3 files changed, 71 insertions(+), 89 deletions(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index c705c3e1..845a53f7 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -47,121 +47,92 @@ you want to open the document. ## The Structure of the Video From File -The basic document structure of a PresentationML document consists of a -number of parts, among which is the Shape Tree (``) element. +The PresentationML document consists of a number of parts, among which is the Picture (``) element. -The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification -introduces the overall form of a `PresentationML` package. +The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification introduces the overall form of a `PresentationML` package. -> This element specifies the presence of a video file. It is defined -> within the non-visual properties of an object. The video is attached to an object, representing it -> shall be attached to an object as this is how it is represented within -> the document. The actual playing of the video however is done within -> the timing node list that is specified under the timing element. -> -> [*Example*: Consider the following ``Picture`` object that has a video attached to it. +Video File (``) specifies the presence of a video file. It is defined within the non-visual properties of an object. The video is attached to an object, representing it shall be attached to an object as this is how it is represented within the document. The actual playing of the video however is done within the timing node list that is specified under the timing element. + +Consider the following ``Picture`` object that has a video attached to it. ```xml - - - - - .. - - - .. - - - .. - - - - .. - + + + + + + + + + + + + + ``` -> In the above example the shape tree specifies all the shape properties -> for this slide. *end example*] -> -> © [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)] - -The following table lists the child elements of the Shape Tree along -with the description of each. +In the above example, we see that there is a single videoFile element attached to this picture. This picture is placed within the document just as a normal picture or shape would be. The id of this picture, namely 7 in this case, is used to refer to this videoFile element from within the timing node list. The Linked relationship id is used to retrieve the actual video file for playback purposes. -| Element | Description | -|---|---| -| cxnSp | Connection Shape | -| extLst | Extension List with Modification Flag | -| graphicFrame | Graphic Frame | -| grpSp | Group Shape | -| grpSpPr | Group Shape Properties | -| nvGrpSpPr | Non-Visual Properties for a Group Shape | -| pic | Picture | -| sp | Shape | +© [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)] -The following XML Schema fragment defines the contents of this element. +The following XML Schema fragment defines the contents of videoFile. ```xml - - - - - - - - - - - - - - + + + + + + ``` ## How the Sample Code Works After opening the presentation file for read/write access in the `using` statement, the code gets the presentation part from the presentation document. Then it gets the relationship ID of -the first slide, and gets the slide part from the relationship ID. +the last slide, and gets the slide part from the relationship ID. -> [!NOTE] -> The test file must have a shape on the first slide. ### [C#](#tab/cs-2) -[!code-csharp[](../../samples/presentation/change_the_fill_color_of_a_shape/cs/Program.cs#snippet2)] +[!code-csharp[](../../samples/presentation/add_video/cs/Program.cs#snippet2)] ### [Visual Basic](#tab/vb-2) -[!code-vb[](../../samples/presentation/change_the_fill_color_of_a_shape/vb/Program.vb#snippet2)] +[!code-vb[](../../samples/presentation/add_video/vb/Program.vb#snippet2)] *** +The code first creates a media data part for the video file to be added. With the video file stream open, it feeds the media data part object. Next, video and media relationship references are added to the slide using the provided embedId for future reference to the video file and mediaEmbedId for media reference. -The code then gets the shape tree that contains the shape whose fill -color is to be changed, and gets the first shape in the shape tree. It -then gets the shape properties of the shape and the solid fill reference of the shape properties, -and assigns a new fill color to the shape. There is no need to explicitly -save the file when inside of a using. +An image part is then added with a sample picture to be used as a placeholder for the video. A picture object is created with various elements, such as Non-Visual Drawing Properties (), which specify non-visual canvas properties. This allows for additional information that does not affect the appearance of the picture to be stored. The element, explained above, is also included. The HyperLinkOnClick () element specifies the on-click hyperlink information to be applied to a run of text or image. When the hyperlink text or image is clicked, the link is fetched. Non-Visual Picture Drawing Properties () specify the non-visual properties for the picture canvas. For a detailed explanation of the elements used, please refer to [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] ### [C#](#tab/cs-3) -[!code-csharp[](../../samples/presentation/change_the_fill_color_of_a_shape/cs/Program.cs#snippet3)] +[!code-csharp[](../../samples/presentation/add_video/cs/Program.cs#snippet3)] ### [Visual Basic](#tab/vb-3) -[!code-vb[](../../samples/presentation/change_the_fill_color_of_a_shape/vb/Program.vb#snippet3)] +[!code-vb[](../../samples/presentation/add_video/vb/Program.vb#snippet3)] *** +Next Media(CT_Media) element is created with use of previously referenced mediaEmbedId(Embedded Picture Reference). Blip element is also added, this element specifies the existence of an image (binary large image or picture) and contains a reference to the image data. Blip's Embed attribute is used to specify an placeholder image in the Image Part created previously. + +### [C#](#tab/cs-4) +[!code-csharp[](../../samples/presentation/add_video/cs/Program.cs#snippet4)] + +### [Visual Basic](#tab/vb-4) +[!code-vb[](../../samples/presentation/add_video/vb/Program.vb#snippet4)] +*** + +All other elements such Offset(``), Stretch(``), fillRectangle(``), are appended to the ShapeProperties(``) and ShapeProperties are appended to the Picture element(``). Finally the picture element that incudes video is added to the ShapeTree(``) of the slide. + +Following is the complete sample code that you can use to add video to the slide. ## Sample Code -Following is the complete sample code that you can use to change the -fill color of a shape in a presentation. ### [C#](#tab/cs) -[!code-csharp[](../../samples/presentation/change_the_fill_color_of_a_shape/cs/Program.cs#snippet0)] +[!code-csharp[](../../samples/presentation/add_video/cs/Program.cs#snippet0)] ### [Visual Basic](#tab/vb) -[!code-vb[](../../samples/presentation/change_the_fill_color_of_a_shape/vb/Program.vb#snippet0)] +[!code-vb[](../../samples/presentation/add_video/vb/Program.vb#snippet0)] *** ## See also - - - [Open XML SDK class library reference](/office/open-xml/open-xml-sdk) diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs index 29dd7c71..753c883c 100644 --- a/samples/presentation/add_video/cs/Program.cs +++ b/samples/presentation/add_video/cs/Program.cs @@ -12,7 +12,7 @@ using DocumentFormat.OpenXml.Packaging; using ApplicationNonVisualDrawingProperties = DocumentFormat.OpenXml.Presentation.ApplicationNonVisualDrawingProperties; - +// AddVideo(args[0], args[1], args[2]); static void AddVideo(string filePath, string videoFilePath, string coverPicPath) @@ -29,7 +29,7 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) { throw new NullReferenceException("Presenation Part is empty or there are no slides in it"); } - + // //Get presentation part PresentationPart presentationPart = presentationDocument.PresentationPart; @@ -38,7 +38,7 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) //Get relationsipId of the last slide - string? videoSldRelationshipId = ((SlideId) slidesIds[0]).RelationshipId; + string? videoSldRelationshipId = ((SlideId) slidesIds[slidesIds.ToArray().Length - 1]).RelationshipId; if (videoSldRelationshipId == null) { @@ -47,7 +47,9 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) //Get slide part by relationshipID SlidePart? slidePart = (SlidePart) presentationPart.GetPartById(videoSldRelationshipId); + // + // // Create video Media Data Part (content type, extension) MediaDataPart mediaDataPart = presentationDocument.CreateMediaDataPart("video/mp4", ".mp4"); @@ -68,13 +70,15 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) ApplicationNonVisualDrawingProperties appNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties(); appNonVisualDrawingProperties.Append(videoFromFile); + + //adds sample image to the slide with id to be used as reference in blip ImagePart imagePart = slidePart.AddImagePart(ImagePartType.Png, imgEmbedId); using (Stream data = File.OpenRead(coverPicPath)) { imagePart.FeedData(data); } - + if (slidePart!.Slide!.CommonSlideData!.ShapeTree == null) { throw new NullReferenceException("Presenation shape tree is empty"); @@ -97,7 +101,9 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) ApplicationNonVisualDrawingPropertiesExtensionList appNonVisualDrawingPropertiesExtensionList = new ApplicationNonVisualDrawingPropertiesExtensionList(); ApplicationNonVisualDrawingPropertiesExtension appNonVisualDrawingPropertiesExtension = new ApplicationNonVisualDrawingPropertiesExtension() { Uri = "{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}" }; + // + // P14.Media media = new() { Embed = mediaEmbedId }; media.AddNamespaceDeclaration("p14", "http://schemas.microsoft.com/office/powerpoint/2010/main"); @@ -112,6 +118,7 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) //Prepare shape properties to display picture BlipFill blipFill = new BlipFill(); A.Blip blip = new A.Blip() { Embed = imgEmbedId }; + // A.Stretch stretch = new A.Stretch(); A.FillRectangle fillRectangle = new A.FillRectangle(); @@ -140,4 +147,5 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) shapeTree.Append(picture); } -} \ No newline at end of file +} +// \ No newline at end of file diff --git a/samples/presentation/add_video/vb/Program.vb b/samples/presentation/add_video/vb/Program.vb index 5d2574db..dc44b108 100644 --- a/samples/presentation/add_video/vb/Program.vb +++ b/samples/presentation/add_video/vb/Program.vb @@ -12,7 +12,7 @@ Imports BlipFill = DocumentFormat.OpenXml.Presentation.BlipFill Imports DocumentFormat.OpenXml.Packaging Imports ApplicationNonVisualDrawingProperties = DocumentFormat.OpenXml.Presentation.ApplicationNonVisualDrawingProperties Imports System.IO - +' Module Program Sub Main(args As String()) AddVideo(args(0), args(1), args(2)) @@ -29,7 +29,7 @@ Module Program If presentationDocument.PresentationPart Is Nothing OrElse presentationDocument.PresentationPart.Presentation.SlideIdList Is Nothing Then Throw New NullReferenceException("Presentation Part is empty or there are no slides in it") End If - + ' ' Get presentation part Dim presentationPart As PresentationPart = presentationDocument.PresentationPart @@ -37,7 +37,7 @@ Module Program Dim slidesIds As OpenXmlElementList = presentationPart.Presentation.SlideIdList.ChildElements ' Get relationshipId of the last slide - Dim videoSldRelationshipId As String = CType(slidesIds(0), SlideId).RelationshipId + Dim videoSldRelationshipId As String = CType(slidesIds(slidesIds.ToArray().Length - 1), SlideId).RelationshipId If videoSldRelationshipId Is Nothing Then Throw New NullReferenceException("Slide id not found") @@ -45,7 +45,8 @@ Module Program ' Get slide part by relationshipID Dim slidePart As SlidePart = CType(presentationPart.GetPartById(videoSldRelationshipId), SlidePart) - + ' + ' ' Create video Media Data Part (content type, extension) Dim mediaDataPart As MediaDataPart = presentationDocument.CreateMediaDataPart("video/mp4", ".mp4") @@ -104,7 +105,8 @@ Module Program Dim appNonVisualDrawingPropertiesExtension As New ApplicationNonVisualDrawingPropertiesExtension() With { .Uri = "{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}" } - + ' + ' Dim media As New P14.Media() With { .Embed = mediaEmbedId } @@ -123,7 +125,7 @@ Module Program Dim blip As New A.Blip() With { .Embed = imgEmbedId } - + ' Dim stretch As New A.Stretch() Dim fillRectangle As New A.FillRectangle() Dim transform2D As New A.Transform2D() @@ -159,4 +161,5 @@ Module Program shapeTree.Append(picture) End Using End Sub -End Module \ No newline at end of file +End Module +' \ No newline at end of file From 86255f99110945b037facce9a7af272baa6ee62e Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Fri, 28 Mar 2025 09:50:00 +0000 Subject: [PATCH 03/21] fixed build warnings --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index 845a53f7..7f6c2dee 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -102,7 +102,7 @@ the last slide, and gets the slide part from the relationship ID. The code first creates a media data part for the video file to be added. With the video file stream open, it feeds the media data part object. Next, video and media relationship references are added to the slide using the provided embedId for future reference to the video file and mediaEmbedId for media reference. -An image part is then added with a sample picture to be used as a placeholder for the video. A picture object is created with various elements, such as Non-Visual Drawing Properties (), which specify non-visual canvas properties. This allows for additional information that does not affect the appearance of the picture to be stored. The element, explained above, is also included. The HyperLinkOnClick () element specifies the on-click hyperlink information to be applied to a run of text or image. When the hyperlink text or image is clicked, the link is fetched. Non-Visual Picture Drawing Properties () specify the non-visual properties for the picture canvas. For a detailed explanation of the elements used, please refer to [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] +An image part is then added with a sample picture to be used as a placeholder for the video. A picture object is created with various elements, such as Non-Visual Drawing Properties (``), which specify non-visual canvas properties. This allows for additional information that does not affect the appearance of the picture to be stored. The `` element, explained above, is also included. The HyperLinkOnClick (``) element specifies the on-click hyperlink information to be applied to a run of text or image. When the hyperlink text or image is clicked, the link is fetched. Non-Visual Picture Drawing Properties (``) specify the non-visual properties for the picture canvas. For a detailed explanation of the elements used, please refer to [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] ### [C#](#tab/cs-3) [!code-csharp[](../../samples/presentation/add_video/cs/Program.cs#snippet3)] From c42167162bb34a495c756540fae775412d529605 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Fri, 28 Mar 2025 10:04:19 +0000 Subject: [PATCH 04/21] revert unintended change in insert_a_new_slideto_cs.csproj --- .../insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj index 08847b93..6b512ec9 100644 --- a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj +++ b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj @@ -1,5 +1 @@ - - - - - \ No newline at end of file + From df45c27ea2fa59d5e3dc7a65abfd3afaf794c1a6 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Fri, 28 Mar 2025 10:05:39 +0000 Subject: [PATCH 05/21] Reverted to match main insert_a_new_slideto_cs.csproj --- .../insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj index 6b512ec9..9609c619 100644 --- a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj +++ b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj @@ -1 +1,2 @@ + From fc7e950ce08241a67aa11b3383c8b06a9518f1f7 Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Fri, 28 Mar 2025 14:02:24 +0000 Subject: [PATCH 06/21] removed .Net framework target --- samples/presentation/add_video/cs/add_video_cs.csproj | 11 +---------- samples/presentation/add_video/vb/add_video_vb.vbproj | 10 +--------- .../cs/insert_a_new_slideto_cs.csproj | 6 +----- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/samples/presentation/add_video/cs/add_video_cs.csproj b/samples/presentation/add_video/cs/add_video_cs.csproj index fd4bd08d..e43252bf 100644 --- a/samples/presentation/add_video/cs/add_video_cs.csproj +++ b/samples/presentation/add_video/cs/add_video_cs.csproj @@ -1,10 +1 @@ - - - - Exe - net9.0 - enable - enable - - - + \ No newline at end of file diff --git a/samples/presentation/add_video/vb/add_video_vb.vbproj b/samples/presentation/add_video/vb/add_video_vb.vbproj index 9edc3769..e43252bf 100644 --- a/samples/presentation/add_video/vb/add_video_vb.vbproj +++ b/samples/presentation/add_video/vb/add_video_vb.vbproj @@ -1,9 +1 @@ - - - - Exe - add_video_vb - net9.0 - - - + \ No newline at end of file diff --git a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj index 08847b93..b4b1d3ea 100644 --- a/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj +++ b/samples/presentation/insert_a_new_slideto/cs/insert_a_new_slideto_cs.csproj @@ -1,5 +1 @@ - - - - - \ No newline at end of file + \ No newline at end of file From 62a8d4ccbfc307e27710b904a2b8b94ab671ce4e Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Mon, 31 Mar 2025 11:19:07 +0100 Subject: [PATCH 07/21] fixing typo --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index 7f6c2dee..fdda8b70 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -11,7 +11,7 @@ ms.suite: office ms.author: o365devx author: o365devx ms.topic: conceptual -ms.date: 02/25/2025 +ms.date: 03/31/2025 ms.localizationpriority: medium --- @@ -51,7 +51,7 @@ The PresentationML document consists of a number of parts, among which is the Pi The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification introduces the overall form of a `PresentationML` package. -Video File (``) specifies the presence of a video file. It is defined within the non-visual properties of an object. The video is attached to an object, representing it shall be attached to an object as this is how it is represented within the document. The actual playing of the video however is done within the timing node list that is specified under the timing element. +Video File (``) specifies the presence of a video file. It is defined within the non-visual properties of an object. The video shall be attached to an object as this is how it is represented within the document. The actual playing of the video however is done within the timing node list that is specified under the timing element. Consider the following ``Picture`` object that has a video attached to it. From 797853973266ad580384c4185d76a899d67afc1b Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 1 Apr 2025 11:22:27 +0100 Subject: [PATCH 08/21] Update samples/presentation/add_video/cs/Program.cs Typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- samples/presentation/add_video/cs/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs index 753c883c..e2696a57 100644 --- a/samples/presentation/add_video/cs/Program.cs +++ b/samples/presentation/add_video/cs/Program.cs @@ -27,7 +27,7 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) if (presentationDocument.PresentationPart == null || presentationDocument.PresentationPart.Presentation.SlideIdList == null) { - throw new NullReferenceException("Presenation Part is empty or there are no slides in it"); + throw new NullReferenceException("Presentation Part is empty or there are no slides in it"); } // //Get presentation part From bc6678774451701fe290eb28e23e8d37eed9922a Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 1 Apr 2025 11:22:49 +0100 Subject: [PATCH 09/21] Update samples/presentation/add_video/cs/Program.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- samples/presentation/add_video/cs/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs index e2696a57..45c0ca1c 100644 --- a/samples/presentation/add_video/cs/Program.cs +++ b/samples/presentation/add_video/cs/Program.cs @@ -81,7 +81,7 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) if (slidePart!.Slide!.CommonSlideData!.ShapeTree == null) { - throw new NullReferenceException("Presenation shape tree is empty"); + throw new NullReferenceException("Presentation shape tree is empty"); } //Getting existing shape tree object from PowerPoint From 83d351e97b51f2edeffa887272b40ab843dec7d3 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 1 Apr 2025 11:22:58 +0100 Subject: [PATCH 10/21] Update samples/presentation/add_video/cs/Program.cs Co-authored-by: Taylor Southwick --- samples/presentation/add_video/cs/Program.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs index 45c0ca1c..1b5b877e 100644 --- a/samples/presentation/add_video/cs/Program.cs +++ b/samples/presentation/add_video/cs/Program.cs @@ -69,8 +69,6 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) ApplicationNonVisualDrawingProperties appNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties(); appNonVisualDrawingProperties.Append(videoFromFile); - - //adds sample image to the slide with id to be used as reference in blip ImagePart imagePart = slidePart.AddImagePart(ImagePartType.Png, imgEmbedId); From b869034c0529cf5e9f2caeb3c2a9b2802f454c5c Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 1 Apr 2025 11:23:32 +0100 Subject: [PATCH 11/21] Update samples/presentation/add_video/cs/Program.cs Co-authored-by: Taylor Southwick --- samples/presentation/add_video/cs/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs index 1b5b877e..c8fb10f9 100644 --- a/samples/presentation/add_video/cs/Program.cs +++ b/samples/presentation/add_video/cs/Program.cs @@ -143,7 +143,6 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) picture.Append(shapeProperties); shapeTree.Append(picture); - } } // \ No newline at end of file From 8db9e3b3cd1dcd2462d61548c7d1e47c0639c5be Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Tue, 1 Apr 2025 12:14:39 +0100 Subject: [PATCH 12/21] applied comments --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 4 ++-- samples/presentation/add_video/cs/Program.cs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index fdda8b70..11c881bb 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -23,9 +23,9 @@ programmatically. ## Getting a Presentation Object -In the Open XML SDK, the `PresentationDocument` class represents a +In the Open XML SDK, the class represents a presentation document package. To work with a presentation document, -first create an instance of the `PresentationDocument` class, and then work with +first create an instance of the **PresentationDocument* class, and then work with that instance. To create the class instance from the document call the `Open` method that uses a file path, and a Boolean value as the second parameter to specify whether a document is diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs index c8fb10f9..666195e7 100644 --- a/samples/presentation/add_video/cs/Program.cs +++ b/samples/presentation/add_video/cs/Program.cs @@ -11,6 +11,9 @@ using BlipFill = DocumentFormat.OpenXml.Presentation.BlipFill; using DocumentFormat.OpenXml.Packaging; using ApplicationNonVisualDrawingProperties = DocumentFormat.OpenXml.Presentation.ApplicationNonVisualDrawingProperties; +using System; +using System.IO; +using System.Linq; // AddVideo(args[0], args[1], args[2]); From 4283f962888ff9416a8b4047a1bd2b60f5e0ba7f Mon Sep 17 00:00:00 2001 From: Alfred Hellstern Date: Tue, 1 Apr 2025 14:11:24 -0700 Subject: [PATCH 13/21] Update how-to-add-a-video-to-a-slide-in-a-presentation.md fixed typos --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index 11c881bb..a56cfea1 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -111,7 +111,7 @@ An image part is then added with a sample picture to be used as a placeholder fo [!code-vb[](../../samples/presentation/add_video/vb/Program.vb#snippet3)] *** -Next Media(CT_Media) element is created with use of previously referenced mediaEmbedId(Embedded Picture Reference). Blip element is also added, this element specifies the existence of an image (binary large image or picture) and contains a reference to the image data. Blip's Embed attribute is used to specify an placeholder image in the Image Part created previously. +Next Media(CT_Media) element is created with use of previously referenced mediaEmbedId(Embedded Picture Reference). The Blip element is also added; this element specifies the existence of an image (binary large image or picture) and contains a reference to the image data. Blip's Embed attribute is used to specify a placeholder image in the Image Part created previously. ### [C#](#tab/cs-4) [!code-csharp[](../../samples/presentation/add_video/cs/Program.cs#snippet4)] From b35f7d881f98efaeeb347f682194c3d4c975eec7 Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Thu, 3 Apr 2025 10:36:26 +0100 Subject: [PATCH 14/21] Updated ms.assetid --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 6 +++--- samples/presentation/add_video/cs/Program.cs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index a56cfea1..75566fe5 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -4,14 +4,14 @@ api_name: - Microsoft.Office.DocumentFormat.OpenXML.Packaging api_type: - schema -ms.assetid: 403abe97-7ab2-40ba-92c0-d6312a6d10c8 +ms.assetid: 536c94b5-dd25-4173-ad6a-b72b95dd7f31 title: 'How to: Add a video to a slide in a presentation' ms.suite: office ms.author: o365devx author: o365devx ms.topic: conceptual -ms.date: 03/31/2025 +ms.date: 04/03/2025 ms.localizationpriority: medium --- @@ -27,7 +27,7 @@ In the Open XML SDK, the method that uses a file path, and a Boolean value as the second parameter to specify whether a document is editable. To open a document for read/write, specify the value `true` for this parameter as shown in the following `using` statement. In this code, the file diff --git a/samples/presentation/add_video/cs/Program.cs b/samples/presentation/add_video/cs/Program.cs index 666195e7..f03c8834 100644 --- a/samples/presentation/add_video/cs/Program.cs +++ b/samples/presentation/add_video/cs/Program.cs @@ -39,7 +39,6 @@ static void AddVideo(string filePath, string videoFilePath, string coverPicPath) //Get slides ids. OpenXmlElementList slidesIds = presentationPart.Presentation.SlideIdList.ChildElements; - //Get relationsipId of the last slide string? videoSldRelationshipId = ((SlideId) slidesIds[slidesIds.ToArray().Length - 1]).RelationshipId; From 6da971d33d9b7ba19564a97ff993dae74710c241 Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Tue, 13 May 2025 09:55:56 +0100 Subject: [PATCH 15/21] updated toc.yaml and removed typo in the file name --- ...r-from-all-the-slides-in-a-presentation.md | 131 ++++++++++++++++++ docs/toc.yml | 4 +- 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentation.md diff --git a/docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentation.md b/docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentation.md new file mode 100644 index 00000000..1613e2a0 --- /dev/null +++ b/docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentation.md @@ -0,0 +1,131 @@ +--- + +api_name: +- Microsoft.Office.DocumentFormat.OpenXML.Packaging +api_type: +- schema +ms.assetid: 3b892a6a-2972-461e-94a9-0a1ede854bda +title: 'Delete all the comments by an author from all the slides in a presentation' +ms.suite: office + +ms.author: o365devx +author: o365devx +ms.topic: conceptual +ms.date: 12/30/2024 +ms.localizationpriority: medium +--- +# Delete all the comments by an author from all the slides in a presentation + +This topic shows how to use the classes in the Open XML SDK for +Office to delete all of the comments by a specific author in a +presentation programmatically. + +> [!NOTE] +> This sample is for PowerPoint modern comments. For classic comments view +> the [archived sample on GitHub](https://github.com/OfficeDev/open-xml-docs/blob/7002d692ab4abc629d617ef6a0214fc2bf2910c8/docs/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md). + + + + + +## Getting a PresentationDocument Object + +In the Open XML SDK, the class represents a +presentation document package. To work with a presentation document, +first create an instance of the `PresentationDocument` class, and then work with +that instance. To create the class instance from the document call the + method that uses a +file path, and a Boolean value as the second parameter to specify +whether a document is editable. To open a document for read/write, +specify the value `true` for this parameter +as shown in the following `using` statement. +In this code, the *fileName* parameter is a string that represents the +path for the file from which you want to open the document, and the +author is the user name displayed in the General tab of the PowerPoint +Options. + +### [C#](#tab/cs-1) +[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet1)] + +### [Visual Basic](#tab/vb-1) +[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet1)] +*** + + +[!include[Using Statement](../includes/presentation/using-statement.md)] `doc`. + +[!include[Structure](../includes/presentation/structure.md)] + +## The Structure of the Comment Element + +The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification +introduces comments in a presentation package. + +> A comment is a text note attached to a slide, with the primary purpose +> of allowing readers of a presentation to provide feedback to the +> presentation author. Each comment contains an unformatted text string +> and information about its author, and is attached to a particular +> location on a slide. Comments can be visible while editing the +> presentation, but do not appear when a slide show is given. The +> displaying application decides when to display comments and determines +> their visual appearance. +> +> © [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)] + +[!include[description of a comment](../includes/presentation/modern-comment-description.md)] + +## How the Sample Code Works + +After opening the presentation document for read/write access and +instantiating the `PresentationDocument` +class, the code gets the specified comment author from the list of +comment authors. + +### [C#](#tab/cs-2) +[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet2)] + +### [Visual Basic](#tab/vb-2) +[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet2)] +*** + + +By iterating through the matching authors and all the slides in the +presentation the code gets all the slide parts, and the comments part of +each slide part. It then gets the list of comments by the specified +author and deletes each one. It also verifies that the comment part has +no existing comment, in which case it deletes that part. It also deletes +the comment author from the comment authors part. + +### [C#](#tab/cs-3) +[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet3)] + +### [Visual Basic](#tab/vb-3) +[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet3)] +*** + + +## Sample Code + +The following method takes as parameters the source presentation file +name and path and the name of the comment author whose comments are to +be deleted. It finds all the comments by the specified author in the +presentation and deletes them. It then deletes the comment author from +the list of comment authors. + +> [!NOTE] +> To get the exact author's name, open the presentation file and click the **File** menu item, and then click **Options**. The **PowerPoint Options** window opens and the content of the **General** tab is displayed. The author's name must match the **User name** in this tab. + +The following is the complete sample code in both C\# and Visual Basic. + +### [C#](#tab/cs) +[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet0)] + +### [Visual Basic](#tab/vb) +[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet0)] +*** + +## See also + + + +- [Open XML SDK class library reference](/office/open-xml/open-xml-sdk) diff --git a/docs/toc.yml b/docs/toc.yml index 5ca0a2ed..a32d40bf 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -46,6 +46,8 @@ href: presentation/overview.md - name: Add a comment to a slide in a presentation href: presentation/how-to-add-a-comment-to-a-slide-in-a-presentation.md + - name: Add a video to a slide in a presentation + href: presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md" - name: Apply a theme to a presentation href: presentation/how-to-apply-a-theme-to-a-presentation.md - name: Change the fill color of a shape in a presentation @@ -53,7 +55,7 @@ - name: Create a presentation document by providing a file name href: presentation/how-to-create-a-presentation-document-by-providing-a-file-name.md - name: Delete all the comments by an author from all the slides in a presentation - href: presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md + href: presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentation.md - name: Delete a slide from a presentation href: presentation/how-to-delete-a-slide-from-a-presentation.md - name: Get all the external hyperlinks in a presentation From 5e9f8d350d18dcd25566db35dd8228265efebb63 Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Tue, 13 May 2025 10:23:24 +0100 Subject: [PATCH 16/21] added deleted file to the pr --- ...or-from-all-the-slides-in-a-presentatio.md | 131 ------------------ docs/toc.yml | 2 +- 2 files changed, 1 insertion(+), 132 deletions(-) delete mode 100644 docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md diff --git a/docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md b/docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md deleted file mode 100644 index 1613e2a0..00000000 --- a/docs/presentation/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md +++ /dev/null @@ -1,131 +0,0 @@ ---- - -api_name: -- Microsoft.Office.DocumentFormat.OpenXML.Packaging -api_type: -- schema -ms.assetid: 3b892a6a-2972-461e-94a9-0a1ede854bda -title: 'Delete all the comments by an author from all the slides in a presentation' -ms.suite: office - -ms.author: o365devx -author: o365devx -ms.topic: conceptual -ms.date: 12/30/2024 -ms.localizationpriority: medium ---- -# Delete all the comments by an author from all the slides in a presentation - -This topic shows how to use the classes in the Open XML SDK for -Office to delete all of the comments by a specific author in a -presentation programmatically. - -> [!NOTE] -> This sample is for PowerPoint modern comments. For classic comments view -> the [archived sample on GitHub](https://github.com/OfficeDev/open-xml-docs/blob/7002d692ab4abc629d617ef6a0214fc2bf2910c8/docs/how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md). - - - - - -## Getting a PresentationDocument Object - -In the Open XML SDK, the class represents a -presentation document package. To work with a presentation document, -first create an instance of the `PresentationDocument` class, and then work with -that instance. To create the class instance from the document call the - method that uses a -file path, and a Boolean value as the second parameter to specify -whether a document is editable. To open a document for read/write, -specify the value `true` for this parameter -as shown in the following `using` statement. -In this code, the *fileName* parameter is a string that represents the -path for the file from which you want to open the document, and the -author is the user name displayed in the General tab of the PowerPoint -Options. - -### [C#](#tab/cs-1) -[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet1)] - -### [Visual Basic](#tab/vb-1) -[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet1)] -*** - - -[!include[Using Statement](../includes/presentation/using-statement.md)] `doc`. - -[!include[Structure](../includes/presentation/structure.md)] - -## The Structure of the Comment Element - -The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification -introduces comments in a presentation package. - -> A comment is a text note attached to a slide, with the primary purpose -> of allowing readers of a presentation to provide feedback to the -> presentation author. Each comment contains an unformatted text string -> and information about its author, and is attached to a particular -> location on a slide. Comments can be visible while editing the -> presentation, but do not appear when a slide show is given. The -> displaying application decides when to display comments and determines -> their visual appearance. -> -> © [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)] - -[!include[description of a comment](../includes/presentation/modern-comment-description.md)] - -## How the Sample Code Works - -After opening the presentation document for read/write access and -instantiating the `PresentationDocument` -class, the code gets the specified comment author from the list of -comment authors. - -### [C#](#tab/cs-2) -[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet2)] - -### [Visual Basic](#tab/vb-2) -[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet2)] -*** - - -By iterating through the matching authors and all the slides in the -presentation the code gets all the slide parts, and the comments part of -each slide part. It then gets the list of comments by the specified -author and deletes each one. It also verifies that the comment part has -no existing comment, in which case it deletes that part. It also deletes -the comment author from the comment authors part. - -### [C#](#tab/cs-3) -[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet3)] - -### [Visual Basic](#tab/vb-3) -[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet3)] -*** - - -## Sample Code - -The following method takes as parameters the source presentation file -name and path and the name of the comment author whose comments are to -be deleted. It finds all the comments by the specified author in the -presentation and deletes them. It then deletes the comment author from -the list of comment authors. - -> [!NOTE] -> To get the exact author's name, open the presentation file and click the **File** menu item, and then click **Options**. The **PowerPoint Options** window opens and the content of the **General** tab is displayed. The author's name must match the **User name** in this tab. - -The following is the complete sample code in both C\# and Visual Basic. - -### [C#](#tab/cs) -[!code-csharp[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/cs/Program.cs#snippet0)] - -### [Visual Basic](#tab/vb) -[!code-vb[](../../samples/presentation/delete_all_the_comments_by_an_author_from_all_the_slides_a_presentatio/vb/Program.vb#snippet0)] -*** - -## See also - - - -- [Open XML SDK class library reference](/office/open-xml/open-xml-sdk) diff --git a/docs/toc.yml b/docs/toc.yml index a32d40bf..c7dd1110 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -47,7 +47,7 @@ - name: Add a comment to a slide in a presentation href: presentation/how-to-add-a-comment-to-a-slide-in-a-presentation.md - name: Add a video to a slide in a presentation - href: presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md" + href: presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md - name: Apply a theme to a presentation href: presentation/how-to-apply-a-theme-to-a-presentation.md - name: Change the fill color of a shape in a presentation From 924ce4cc228648929b00b7c8a8dc38f4f34a5a20 Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Tue, 13 May 2025 10:44:20 +0100 Subject: [PATCH 17/21] updated overview and working with comments files --- docs/presentation/overview.md | 2 +- docs/presentation/working-with-comments.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/presentation/overview.md b/docs/presentation/overview.md index f2dbeb7e..9ac7fc97 100644 --- a/docs/presentation/overview.md +++ b/docs/presentation/overview.md @@ -30,7 +30,7 @@ This section provides how-to topics for working with presentation documents usin - [Create a presentation document by providing a file name](how-to-create-a-presentation-document-by-providing-a-file-name.md) -- [Delete all the comments by an author from all the slides in a presentation](how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md) +- [Delete all the comments by an author from all the slides in a presentation](how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentation.md) - [Delete a slide from a presentation](how-to-delete-a-slide-from-a-presentation.md) diff --git a/docs/presentation/working-with-comments.md b/docs/presentation/working-with-comments.md index 19b5e81b..9b8b0409 100644 --- a/docs/presentation/working-with-comments.md +++ b/docs/presentation/working-with-comments.md @@ -193,4 +193,4 @@ article. [About the Open XML SDK for Office](../about-the-open-xml-sdk.md) [How to: Create a Presentation by Providing a File Name](how-to-create-a-presentation-document-by-providing-a-file-name.md) [How to: Add a comment to a slide in a presentation](how-to-add-a-comment-to-a-slide-in-a-presentation.md) -[How to: Delete all the comments by an author from all the slides in a presentation](how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentatio.md) +[How to: Delete all the comments by an author from all the slides in a presentation](how-to-delete-all-the-comments-by-an-author-from-all-the-slides-in-a-presentation.md) From f4b38b38786bc34e6b0968def8ef50e53716b257 Mon Sep 17 00:00:00 2001 From: MARIUSZ KASZEWIAK Date: Tue, 13 May 2025 11:50:14 +0100 Subject: [PATCH 18/21] added overview.md entry for add video --- docs/presentation/overview.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/presentation/overview.md b/docs/presentation/overview.md index 9ac7fc97..26ab6c19 100644 --- a/docs/presentation/overview.md +++ b/docs/presentation/overview.md @@ -22,7 +22,9 @@ This section provides how-to topics for working with presentation documents usin - [Structure of a PresentationML document](structure-of-a-presentationml-document.md) -- [Add a comment to a slide in a presentation](how-to-add-a-comment-to-a-slide-in-a-presentation.md) +- [Add a comment to a slide in a presentation](how-to-add-a-comment-to-a-slide-in-a-presentation.md) + +- [Add a video to a slide in a presentation](how-to-add-a-video-to-a-slide-in-a-presentation.md) - [Apply a theme to a presentation](how-to-apply-a-theme-to-a-presentation.md) From 2163d2f5b0ac48386c71d4609ac6e8700127efdc Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 13 May 2025 18:10:46 +0100 Subject: [PATCH 19/21] Update docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md Co-authored-by: Michael Bowen <10384982+mikeebowen@users.noreply.github.com> --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index 75566fe5..58be8717 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -53,7 +53,7 @@ The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-295 Video File (``) specifies the presence of a video file. It is defined within the non-visual properties of an object. The video shall be attached to an object as this is how it is represented within the document. The actual playing of the video however is done within the timing node list that is specified under the timing element. -Consider the following ``Picture`` object that has a video attached to it. +Consider the following `Picture` object that has a video attached to it. ```xml From e53cec16791332f5f4b059607b1c09129395089f Mon Sep 17 00:00:00 2001 From: Mariusz Date: Tue, 13 May 2025 18:11:02 +0100 Subject: [PATCH 20/21] Update docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md Co-authored-by: Michael Bowen <10384982+mikeebowen@users.noreply.github.com> --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index 58be8717..a5e14981 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -120,7 +120,7 @@ Next Media(CT_Media) element is created with use of previously referenced mediaE [!code-vb[](../../samples/presentation/add_video/vb/Program.vb#snippet4)] *** -All other elements such Offset(``), Stretch(``), fillRectangle(``), are appended to the ShapeProperties(``) and ShapeProperties are appended to the Picture element(``). Finally the picture element that incudes video is added to the ShapeTree(``) of the slide. +All other elements such Offset(``), Stretch(``), FillRectangle(``), are appended to the ShapeProperties(``) and ShapeProperties are appended to the Picture element(``). Finally the picture element that incudes video is added to the ShapeTree(``) of the slide. Following is the complete sample code that you can use to add video to the slide. From 780f1ee6892c4068b3ea772d13fb88e1d8fb85b8 Mon Sep 17 00:00:00 2001 From: Mariusz Date: Wed, 14 May 2025 16:36:44 +0100 Subject: [PATCH 21/21] Update docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md Co-authored-by: Michael Bowen <10384982+mikeebowen@users.noreply.github.com> --- .../how-to-add-a-video-to-a-slide-in-a-presentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md index a5e14981..8ea4ea4b 100644 --- a/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md +++ b/docs/presentation/how-to-add-a-video-to-a-slide-in-a-presentation.md @@ -25,7 +25,7 @@ programmatically. In the Open XML SDK, the class represents a presentation document package. To work with a presentation document, -first create an instance of the **PresentationDocument* class, and then work with +first create an instance of the **PresentationDocument** class, and then work with that instance. To create the class instance from the document call the method that uses a file path, and a Boolean value as the second parameter to specify whether a document is