Skip to content

Commit

Permalink
Merge pull request #94 from VijayadharshiniMathiyalagan/ES-882954-How…
Browse files Browse the repository at this point in the history
…-to-editing-the-alt-text-in-image

Add sample for edit text and alt text of image
  • Loading branch information
MohanaselvamJothi authored Dec 31, 2024
2 parents 3170721 + 8b72a4c commit 7034cbb
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
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 not shown.
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.
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);

0 comments on commit 7034cbb

Please sign in to comment.