Skip to content

Commit

Permalink
Presentation Slide Remove Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DraviaVemal committed Apr 17, 2024
1 parent 9557b9b commit a5203eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<LangVersion>5.0</LangVersion>
<OutputPath>..\bin\</OutputPath>
<Authors>DraviaVemal</Authors>
<Version>2.6.15</Version>
<Version>2.6.16</Version>
<Company>DraviaVemal</Company>
<Copyright>Copyright (c) 2023 DraviaVemal
Permission is hereby granted, free of charge, to any person obtaining a copy of this
Expand Down
14 changes: 7 additions & 7 deletions Global/Components/Charts/2007/PieChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ private SolidFillModel GetDataPointBorder(uint index, int seriesIndex)
}
private C.PieChartSeries CreateChartSeries(int seriesIndex, ChartDataGrouping chartDataGrouping)
{
C.DataLabels dataLabels = null;
if (seriesIndex < pieChartSetting.pieChartSeriesSettings.Count)
{
PieChartDataLabel pieChartDataLabel1 = pieChartSetting.pieChartSeriesSettings.ElementAtOrDefault(seriesIndex) != null ? pieChartSetting.pieChartSeriesSettings.ElementAtOrDefault(seriesIndex).pieChartDataLabel : null;
int dataLabelCellsLength = chartDataGrouping.dataLabelCells != null ? chartDataGrouping.dataLabelCells.Length : 0;
dataLabels = CreatePieDataLabels(pieChartDataLabel1 ?? new PieChartDataLabel(), dataLabelCellsLength);
}
C.PieChartSeries series = new C.PieChartSeries(
new C.Index { Val = new UInt32Value((uint)chartDataGrouping.id) },
new C.Order { Val = new UInt32Value((uint)chartDataGrouping.id) },
CreateSeriesText(chartDataGrouping.seriesHeaderFormula, new[] { chartDataGrouping.seriesHeaderCells }));
for (uint index = 0; index < chartDataGrouping.xAxisCells.Length; index++)
{
C.DataLabels dataLabels = null;
if (seriesIndex < pieChartSetting.pieChartSeriesSettings.Count)
{
PieChartDataLabel pieChartDataLabel1 = pieChartSetting.pieChartSeriesSettings.ElementAtOrDefault(seriesIndex) != null ? pieChartSetting.pieChartSeriesSettings.ElementAtOrDefault(seriesIndex).pieChartDataLabel : null;
int dataLabelCellsLength = chartDataGrouping.dataLabelCells != null ? chartDataGrouping.dataLabelCells.Length : 0;
dataLabels = CreatePieDataLabels(pieChartDataLabel1 ?? new PieChartDataLabel(), dataLabelCellsLength);
}
C.DataPoint dataPoint = new C.DataPoint(new C.Index { Val = index }, new C.Bubble3D { Val = false });
ShapePropertiesModel shapePropertiesModel = new ShapePropertiesModel()
{
Expand Down
13 changes: 12 additions & 1 deletion Presentation/Internal/Presentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,18 @@ internal void RemoveSlideByIndex(int SlideIndex)
P.SlideId SlideId = (P.SlideId)GetSlideIdList().ElementAt(SlideIndex);
SlidePart SlidePart = (SlidePart)GetPresentationPart().GetPartById(SlideId.RelationshipId.Value);
GetSlideIdList().RemoveChild(SlideId);
GetPresentationPart().DeleteReferenceRelationship(SlideId.RelationshipId.Value);
try
{
GetPresentationPart().DeleteReferenceRelationship(SlideId.RelationshipId.Value);
}
catch (ArgumentNullException)
{
//ignore
}
catch (Exception ex)
{
throw ex;

Check warning on line 78 in Presentation/Internal/Presentation.cs

View workflow job for this annotation

GitHub Actions / build-CsProj

Re-throwing caught exception changes stack information (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2200)

Check warning on line 78 in Presentation/Internal/Presentation.cs

View workflow job for this annotation

GitHub Actions / build-CsProj

Re-throwing caught exception changes stack information (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2200)
}
GetPresentationPart().DeletePart(SlidePart);
}
else
Expand Down

0 comments on commit a5203eb

Please sign in to comment.