Add Title to the top of the slide

Hi,

Could you please give me example on how to add Title/Header text to the top of the each slide in center position.
Also I need to add logo at the bottom just above the copyright text.

Appreciate your support.

Best Regards.

@sayakg,

I have observed your comments. Can you please share sample presentation so that we may further investigate to help you out.

Best Regards,

Adnan Ahmad

test.zip (53.8 KB)

Hi Adnan,

I have attached the sample ppt file.
I need to add header, footer and title of the slide at the top.

Please advise.

Thanks.

@sayakg,

I have observed your comments. I have shared a code snippet. This will help you to achieve your requirements. Please share feedback with us if there is still an issue.

public static void ManageHeader()
{
    String path = @"F:\Aspose Work\";
    Presentation presentation = new Presentation(path + "handout_header_footer.pptx");

    IMasterSlide masterSlide = presentation.Masters[0];
    
   
    if (masterSlide != null)
        updateHeaderFooterText(masterSlide);

    foreach(ILayoutSlide layout in masterSlide.LayoutSlides)
    {

        foreach (IShape shape in layout.Shapes)
        {
            if (shape.Placeholder != null)
            {
                if (shape.Placeholder.Type == PlaceholderType.Title)
                {
                    shape.X = 10;
                    shape.Y = 20;
                 
                }
            }
        }
    }

    presentation.Save(path + "handout_test.pptx", SaveFormat.Pptx);
}

public static void updateHeaderFooterText(IBaseSlide master)
{
    foreach (IShape shape in master.Shapes)
    {
        if (shape.Placeholder != null)
        {
            if (shape.Placeholder.Type == PlaceholderType.Header)
            {
                shape.X = 0;
                shape.Y = 20;
                ((IAutoShape)shape).TextFrame.Text = "HI there new header";

            }
            if (shape.Placeholder.Type == PlaceholderType.Footer)
            {
                ((IAutoShape)shape).TextFrame.Text = "HI there new footer";
                shape.X = 0;
                shape.Y = 70;
            }
        }
    }
}

Best Regards,

Adnan Ahmad

Thank you @Adnan.Ahmad