-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from VijayadharshiniMathiyalagan/ES-882954-How…
…-to-editing-the-alt-text-in-image Add sample for edit text and alt text of image
- Loading branch information
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
Slides/Edit-text-and-image-alt-text/Edit-text-and-image-alt-text.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.12.35417.141 d17.12 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Edit-text-and-image-alt-text", "Edit-text-and-image-alt-text\Edit-text-and-image-alt-text.csproj", "{E1319FAA-3500-4DAE-A3C6-35FFB542911F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E1319FAA-3500-4DAE-A3C6-35FFB542911F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E1319FAA-3500-4DAE-A3C6-35FFB542911F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E1319FAA-3500-4DAE-A3C6-35FFB542911F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E1319FAA-3500-4DAE-A3C6-35FFB542911F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+235 KB
Slides/Edit-text-and-image-alt-text/Edit-text-and-image-alt-text/Data/Template.pptx
Binary file not shown.
24 changes: 24 additions & 0 deletions
24
...-text-and-image-alt-text/Edit-text-and-image-alt-text/Edit-text-and-image-alt-text.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Edit_text_and_image_alt_text</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Presentation.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Data\Template.pptx"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Output\.gitkeep"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
Empty file.
23 changes: 23 additions & 0 deletions
23
Slides/Edit-text-and-image-alt-text/Edit-text-and-image-alt-text/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Syncfusion.Presentation; | ||
|
||
//Load or open an PowerPoint Presentation. | ||
using FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite); | ||
//Open an existing PowerPoint presentation. | ||
using IPresentation pptxDoc = Presentation.Open(inputStream); | ||
//Retrieve the slide instance. | ||
ISlide slide = pptxDoc.Slides[0]; | ||
//Retrieves the first shape. | ||
IShape shape = slide.Shapes[0] as IShape; | ||
//Retrieves the first paragraph of the shape. | ||
IParagraph paragraph = shape.TextBody.Paragraphs[0]; | ||
//Retrieves the first TextPart of the shape. | ||
ITextPart textPart = paragraph.TextParts[0]; | ||
//Modifies the text content of the TextPart. | ||
textPart.Text = "Hello Presentation"; | ||
//Retrieve the first picture from the slide. | ||
IPicture picture = slide.Pictures[0]; | ||
//Modifies the label of the image. | ||
picture.Description = "Replaced alt text"; | ||
//Saves the modified PowerPoint Presentation. | ||
using FileStream outputStream = new(Path.GetFullPath(@"Output/Result.pptx"), FileMode.Create, FileAccess.ReadWrite); | ||
pptxDoc.Save(outputStream); |