Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: slide picture border color fix #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down
27 changes: 27 additions & 0 deletions SoftUni-PowerPoint-Converter/SoftUniPowerPointConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using static SoftUniConverterCommon.ConverterUtils;
using Shape = Microsoft.Office.Interop.PowerPoint.Shape;
using System.Security.Policy;
using System.Drawing;

public class SoftUniPowerPointConverter
{
Expand Down Expand Up @@ -77,6 +78,8 @@ public static void ConvertAndFixPresentation(string pptSourceFileName,

FixSlideNotesPages(pptDestination);

FixSlidePictureBorders(pptDestination);

pptDestination.Save();
if (!appWindowVisible)
pptDestination.Close();
Expand Down Expand Up @@ -682,4 +685,28 @@ Shape FindNotesFooter()
}
}
}

static void FixSlidePictureBorders(Presentation presentation)
{
Console.WriteLine("Fixing picture borders...");

for (int i = 1; i <= presentation.Slides.Count; i++)
{
Slide currentSlide = presentation.Slides[i];
for (int shapeNum = 1; shapeNum <= currentSlide.Shapes.Count; shapeNum++)
{
Shape currentShape = currentSlide.Shapes[shapeNum];
if (currentShape.Type == MsoShapeType.msoPicture)
{
currentShape.Line.Visible = MsoTriState.msoTrue;

// Can't get theme colors and copying the old border is unreliable
// so use hardcoded gray taken from the template
currentShape.Line.ForeColor.RGB = ColorTranslator.ToOle(Color.FromArgb(162, 169, 184));
}
}

Console.WriteLine($" Fixed the picute borders at slide #{i}");
}
}
}