Skip to content

Commit

Permalink
Merge pull request #44 from snehasf3509/master
Browse files Browse the repository at this point in the history
ES-868612 Sample to enable ShowLeaderLines for a chart in a PPTX
  • Loading branch information
MohanaselvamJothi authored Feb 13, 2024
2 parents da76e2f + c99e927 commit 7b3af41
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Charts/Show-Leader-Lines/.NET/Show-Leader-Lines.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Show-Leader-Lines", "Show-Leader-Lines\Show-Leader-Lines.csproj", "{81CC17C3-31B4-432C-81E3-73D893AEC61B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{81CC17C3-31B4-432C-81E3-73D893AEC61B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81CC17C3-31B4-432C-81E3-73D893AEC61B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81CC17C3-31B4-432C-81E3-73D893AEC61B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81CC17C3-31B4-432C-81E3-73D893AEC61B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {628DABCE-496F-4F7C-9C10-F01B07445872}
EndGlobalSection
EndGlobal
Binary file not shown.
32 changes: 32 additions & 0 deletions Charts/Show-Leader-Lines/.NET/Show-Leader-Lines/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

using Syncfusion.OfficeChart;
using Syncfusion.Presentation;

namespace Format_Data_Labels
{
class Program
{
static void Main(string[] args)
{
FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"../../../Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

//Open an existing PowerPoint Presentation.
using (IPresentation pptxDoc = Presentation.Open(fileStreamPath))
{
//Gets the first slide.
ISlide slide = pptxDoc.Slides[0];
//Gets the chart in slide.
IPresentationChart chart = slide.Charts[0];

//Show leader lines enabled
chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.ShowLeaderLines = true;

using (FileStream outputStream = new FileStream(Path.GetFullPath(@"../../../Result.pptx"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Format_Data_Labels</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Syncfusion.Presentation.Net.Core" Version="*" />
</ItemGroup>
</Project>

0 comments on commit 7b3af41

Please sign in to comment.