Retrieving footer date format in PowerPoint

R

renz.eullo

Hi everyone,

How can I retrieve the footer date format in PowerPoint using C#?
Right now, I can only retrieve the date and the format in English, but
if it is set to some other language, say Japanese, it still retrieves
the same data.

Thanks in advance.

Regards,
Renz
 
R

renz.eullo

A couple of questions for you:

What version of PowerPoint are you using/trying to automate?

When you say "if it is set to some other language" what exactly do you mean?  
Can you give specific steps to set it the way you mean?  

What exact data do you get back and what code are you using now to get atit?

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================

Hi Steve,
What version of PowerPoint are you using/trying to automate?
I'm trying to automate PowerPoint 2003 and 2007. But the problem is
not observed in PowerPoint 2007.
When you say "if it is set to some other language" what exactly do you mean?
Can you give specific steps to set it the way you mean?
In the Header and Footer dialog, check "Date and time". Inside that,
choose "Update automatically", and select a "Language" that is not
English, for example, Japanese.
What exact data do you get back and what code are you using now to get atit?
code used is the following:

if (slide.HeadersFooters.DateAndTime.Visible == MsoTriState.msoTrue)
{
String tempDate = shape.TextFrame.TextRange.Text;
}

tempDate was assigned November 08, even though I selected Japanese for
the language.

It works on PowerPoint 2007 but not on PowerPoint 2003.

Any insights? Thanks in advance!

Regards,
Renz
 
R

renz.eullo

OK, thanks.  That sets the way the date is displayed, not the characterset in
which it's displayed.  You'll still get the year, month and day in roman
characters, but if you choose Japanese, they'll be in Year/Month/Day order instead
of the usual US Month/Day/Year or other order.

If the Calendar Type is set to Japanese Emperor Reign, the display will change to
kanji:  Heisei 20 nen, 11 gatsu 17 nichi.  Is that what you've done?

But PPT 2003 and 2007 behave quite differently when it comes to headers/footers.  
In PPT 2007, the headers/footers become shapes on individual slides that you can
select and manipulate with code like:

    With ActivePresentation.Slides(2).HeadersFooters
        Debug.Print .DateAndTime.Text
    End With

The same code in 2003 gives you errors; Headers/Footers in 2003 don't produce
shapes on individual slides.  If you use one of the predefined values for date on
the master, you get something that looks like <<#>> as the text.  PPT fills in the
appropriate date value and displays it on slides but you can't, near as Ican
tell, retrieve it by code.

Depending on what you're after, you might be able to work out how PPT is
formatting the date then format the system date yourself to arrive at thesame
text.








-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================

Thanks Steve. Sounds like I need to simulate how PowerPoint displays
it. >.<
Do you know of a way to retrieve the Calendar Type used?

Regards,
Renz
 
R

renz.eullo

Indirectly, I think so.

Run this from within PPT (view the slide with date activated, use Tools, Macros, Run
macro to run the code:

Sub thing()
    Dim x As Long
    With ActivePresentation.Slides(1).Master.HeadersFooters
        For x = 1 To 20
        With .DateAndTime
            .Format = x
            MsgBox .Format
        End With
        Next x
    End With
End Sub

The different format values seem to be what you're after.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================

Hi Steve,

Actually, I am already able to get the format correctly.
What I am not able to do is to retrieve the Language and Calendar Type
that the date is in.
Do you have an idea how to do it?

Thanks in advance!

Regards,
Renz
 
R

renz.eullo

It appears that some formats are tied to the calendar type.

Try running the code above while you watch what happens to the date footer.

If that doesn't seem to help, I'm out of ideas, I'm afraid.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================

Hi Steve,
Thanks a lot for the help. ^_^

In case anyone else know how to retrieve the Calendar Type related
data, can you please share? Any help is greatly appreciated. ^_^

Regards,
Renz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top