none
change footer excel and powerpoint font size through vsto RRS feed

  • Question

  • how to change footer excel and powerpoint font size?

    my code:

    excel:

    Microsoft.Office.Interop.Excel.Worksheet exc = (Microsoft.Office.Interop.Excel.Worksheet)Globals.ThisAddIn.Application.ActiveSheet;

    exc.PageSetup.LeftFooter = "ABC";

     

    powerpoint:

    Microsoft.Office.Interop.PowerPoint.Presentation pst = (Microsoft.Office.Interop.PowerPoint.Presentation)Globals.ThisAddIn.Application.ActivePresentation;

    pst.Slides[1].HeadersFooters.Footer.Visible = Office.MsoTriState.msoTrue;
    pst.Slides[1].HeadersFooters.Footer.Text = "ABC";

     

    Thanks




    Tuesday, March 29, 2011 8:38 AM

Answers

  • Hi Yan2010,

    As far as I know, that we’re not able to change the font format of excel left footer. And PowerPoint footer is a shape. You’re able to iterate the shapes in the slide to find it out and move it to the place where you want. This is a sample to move the footer to the left side and change the text size to 25.

    private void button1_Click(object sender, RibbonControlEventArgs e)
        {
          try
          {
            PowerPoint.Application app = Globals.ThisAddIn.Application;
            PowerPoint.Presentation Presentation = app.ActivePresentation;
            PowerPoint.Slide slide = Presentation.Slides[1];
            slide.HeadersFooters.Footer.Visible = Office.MsoTriState.msoTrue;
            slide.HeadersFooters.Footer.Text = "Test";
            PowerPoint.Shape shap = slide.Shapes[3];
            shap.Left = 0;
            if (shap.HasTextFrame == Office.MsoTriState.msoTrue)
            {
              shap.TextEffect.FontSize = 25;
            }
          }
          catch (Exception ex)
          {
            System.Windows.Forms.MessageBox.Show(ex.Message, "Exception");
          }
        }
    

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Yan2010 Friday, April 1, 2011 1:52 AM
    Thursday, March 31, 2011 8:59 AM
    Moderator

All replies

  • Hi Yan2010,

    Thanks for posting in the MSDN Forum.

    Your Excel snippet will set a left foot on the page. You will see if in you print preview screen.

    And I’m not able to find out the PowerPoint snippet has any relationship with PowerPoint font size. Would you please give me more detail for research?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 31, 2011 2:28 AM
    Moderator
  • Hello Tom,

    I mean in excel and powerpoint how to change font format, such as changing the font to arial and size to 10, and how to set the footer in powerpoint for the left.

     

    Thanks,

    Yan


    Thursday, March 31, 2011 6:53 AM
  • Hi Yan2010,

    As far as I know, that we’re not able to change the font format of excel left footer. And PowerPoint footer is a shape. You’re able to iterate the shapes in the slide to find it out and move it to the place where you want. This is a sample to move the footer to the left side and change the text size to 25.

    private void button1_Click(object sender, RibbonControlEventArgs e)
        {
          try
          {
            PowerPoint.Application app = Globals.ThisAddIn.Application;
            PowerPoint.Presentation Presentation = app.ActivePresentation;
            PowerPoint.Slide slide = Presentation.Slides[1];
            slide.HeadersFooters.Footer.Visible = Office.MsoTriState.msoTrue;
            slide.HeadersFooters.Footer.Text = "Test";
            PowerPoint.Shape shap = slide.Shapes[3];
            shap.Left = 0;
            if (shap.HasTextFrame == Office.MsoTriState.msoTrue)
            {
              shap.TextEffect.FontSize = 25;
            }
          }
          catch (Exception ex)
          {
            System.Windows.Forms.MessageBox.Show(ex.Message, "Exception");
          }
        }
    

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Yan2010 Friday, April 1, 2011 1:52 AM
    Thursday, March 31, 2011 8:59 AM
    Moderator