PowerPoint Presentations with ThemeOverride parts

Home Forums Open-Xml-PowerTools PowerPoint Presentations with ThemeOverride parts

This topic contains 1 reply, has 1 voice, and was last updated by  markruban 7 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4039

    markruban
    Participant

    When processing PowerPoint Presentations (splitting / merging pptx(s) in C# code) using OpenXml Power Tools, getting lost ThemeOverride parts. As a result losing original font color on charts. When splitting a pptx file into single slide presentations, is there any way to copy ThemeOverride parts? Thanks!

    #4044

    markruban
    Participant

    I believe I’ve fixed the issue by adding the code listed below at the end of CopyChartObjects function in the OpenXmlPowerTools PresentationBuilder.cs:

    private static void CopyChartObjects(ChartPart oldChart, ChartPart newChart)
    {
    ……………………………………………………………..
    foreach (var oldTop in oldChart.Parts.Where(p => p.OpenXmlPart.ContentType == “application/vnd.openxmlformats-officedocument.themeOverride+xml”))
    {
    var newId = “R” + Guid.NewGuid().ToString().Replace(“-“, “”).Substring(0, 16);
    ThemeOverridePart newTop = newChart.AddNewPart<ThemeOverridePart>(“application/vnd.openxmlformats-officedocument.themeOverride+xml”, newId);
    newTop.FeedData(oldTop.OpenXmlPart.GetStream());

    newChart.CreateRelationshipToPart(newTop, newId);
    }
    }

    It works for me, but please correct me if I’m doing something wrong.

    Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.