cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to use document properties inside the document

HolgerSteffen
1-Newbie

How to use document properties inside the document

I want to use the document properties (author and title) and the file name of the Document and some custom defined properties to show them at the header of the document

(I want to use an embedded excelsheet to show the properties formated) and at the head line of each page.

At this time, I put a VBA script-object in the document, which reads the data using

Set metadata = worksheet.metadata

Set items = metadata.customitems

For each item in items

...

If (item.name = "m_discription") Then
Outputs(1).Value = item.value

End If

...

Next

(I'm not familiar with VBA, I found this code lines in a forum)

It works.

My questions:

-Is there another solution for referencing the meta-data inside the doc and inside the header and footer?

(As in Word, for example?)

-How can I get ,title' and ,author' from the builtin document properties and the filename?

Thanks,

H.Steffen

1 ACCEPTED SOLUTION

Accepted Solutions

At this time, I put a VBA script-object in the document, which reads the data using

As a minor technical point, it's not VBA, it's VBscript.

-Is there another solution for referencing the meta-data inside the doc and inside the header and footer?

(As in Word, for example?)

No. The only way to do this is via a VBscript.

-How can I get ,title' and ,author' from the builtin document properties and the filename?

Here's a function based on a scripted component that will get any metadata item. To get the filename requires another function based on a scripted component.

View solution in original post

17 REPLIES 17

At this time, I put a VBA script-object in the document, which reads the data using

As a minor technical point, it's not VBA, it's VBscript.

-Is there another solution for referencing the meta-data inside the doc and inside the header and footer?

(As in Word, for example?)

No. The only way to do this is via a VBscript.

-How can I get ,title' and ,author' from the builtin document properties and the filename?

Here's a function based on a scripted component that will get any metadata item. To get the filename requires another function based on a scripted component.

MikeArmstrong
5-Regular Member
(To:RichardJ)

Nice worksheet.

Are you planning on putting your scripted components in the FAQ document?

Mike

Are you planning on putting your scripted components in the FAQ document?

Yes, I agree that shod be one of the linked documents. A ot of the components that people ask for are already in that document.

Holger Steffen wrote:

I want to use the document properties (author and title) and the file name of the Document and some custom defined properties to show them at the header of the document

(I want to use an embedded excelsheet to show the properties formated) and at the head line of each page.

At this time, I put a VBA script-object in the document, which reads the data using

Set metadata = worksheet.metadata

Set items = metadata.customitems

For each item in items

...

If (item.name = "m_discription") Then
Outputs(1).Value = item.value

End If

...

Next

(I'm not familiar with VBA, I found this code lines in a forum)

It works.

My questions:

-Is there another solution for referencing the meta-data inside the doc and inside the header and footer?

(As in Word, for example?)

-How can I get ,title' and ,author' from the builtin document properties and the filename?

Thanks,

H.Steffen

You can't insert a Header (View/Header/footer) and insert file information in them? Version 11 allows this.

You can't insert a Header (View/Header/footer) and insert file information in them? Version 11 allows this.

I had forgotten you can get the filename and path directly in the header. But in versions 12 and later, no, they did not add the capability of directly accessing the metadata.

Richard Jackson wrote:

You can't insert a Header (View/Header/footer) and insert file information in them? Version 11 allows this.

I had forgotten you can get the filename and path directly in the header. But in versions 12 and later, no, they did not add the capability of directly accessing the metadata.

Created in version 14, printed to pdf file for discussion.

But you can't get the meta data, such as Company, Author, etc, so easily.

How have you managed to do that Fred?

Mike

Mathcad (v14at least)can create headeers and footers almost like Word. From the View menu select header and footer, and get a window segmented inot three sections with buttons to input file, date, path, images, etc.

Cheers Fred,

I haven't ever tried inserting the file path and name. The only problem is the Mathcad extension at the end of the file name.

An example of a calc number we use is 20000-CAL-DENG-001, but we don't have xmcd on the end.

Mike

Thank you very much.

I will implement that code next time i my form!

If you are looking for scripted components similar to the examples posted here try searching for Extra Components, created by Richard, also Phillip Oakley created a good sheet with many useful functions.

Mike

I have found them see attached, worth filing.

Mike

Thank you, I will do (not now, to much work ...;-)

I will there also look for my 2nd problem:

Putting in the Date of Printing automatically!

The attached is an extract from Richards worksheet, which shows the current date and time.

Mike

Oh another example which has a calendar and also shows the current date as a string.

Mike

Thank you!

Top Tags