Read ActiveDocument.BuiltInDocumentProperties without modifying the file?

Add-in Express™ Support Service
That's what is more important than anything else

Read ActiveDocument.BuiltInDocumentProperties without modifying the file?
 
Mark De Lorenzo




Posts: 27
Joined: 2015-06-22
I'm trying to simply retrieve some document properties. Mainly the Title of the document. But when I read WordApp.ActiveDocument.BuiltInDocumentProperties("Title").Value, it modifies the open file?

Is there a cleaner way to retrieve the document properties without making the file dirty?
Posted 08 Dec, 2017 08:05:12 Top
Andrei Smolin


Add-in Express team


Posts: 14593
Joined: 2006-05-11
Hello Mark,

I reproduce this issue (using a VBA macro) if that property isn't set in my test document; the document gets changed when I access Office.DocumentProperty.Value. If I set that property on my test document, accessing Office.DocumentProperty.Value doesn't produce this issue.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Dec, 2017 08:18:12 Top
Mark De Lorenzo




Posts: 27
Joined: 2015-06-22
Andrei Smolin writes:
I reproduce this issue (using a VBA macro) if that property isn't set in my test document; the document gets changed when I access Office.DocumentProperty.Value. If I set that property on my test document, accessing Office.DocumentProperty.Value doesn't produce this issue.

Thank you for your quick response.

So in VB.NET using Add-In-Express. I'm using;
WordApp.ActiveDocument.BuiltInDocumentProperties("Title").Value
I have verified that the Title is already populated in the Word Doc that I opened.
When displaying WordApp.ActiveDocument.BuiltInDocumentProperties("Title").Value in a MessageBox.Show, it modifies the file.
Any ideas?
Posted 08 Dec, 2017 09:01:46 Top
Andrei Smolin


Add-in Express team


Posts: 14593
Joined: 2006-05-11
Download http://temp.add-in-express.com/support/Document1.docx, open it in Word, enable editing, close it. Now test your code on it. Do you see the same issue?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Dec, 2017 09:22:24 Top
Mark De Lorenzo




Posts: 27
Joined: 2015-06-22
Andrei Smolin writes:
Download http://temp.add-in-express.com/support/Document1.docx, open it in Word, enable editing, close it. Now test your code on it. Do you see the same issue?

Hey Andrei,

Saved document to my desktop
Opened in Word, wasn't prompted for enabling editing.
Yes, same behavior when I click by Ribbon Button. File becomes dirty with just this line;
MessageBox.Show(WordApp.ActiveDocument.BuiltInDocumentProperties("Title").Value)

If I comment it out and click my Button, Word can be closed without prompts for saving.
Posted 08 Dec, 2017 09:33:53 Top
Andrei Smolin


Add-in Express team


Posts: 14593
Joined: 2006-05-11
Hello Mark,

What Office build are you using?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 11 Dec, 2017 03:31:17 Top
Andrei Smolin


Add-in Express team


Posts: 14593
Joined: 2006-05-11
Also, make sure *all* other COM add-ins are turned off and no macro exists in the document or in the template that the document is based on. Do you test on a saved document or on a new one?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 11 Dec, 2017 03:36:16 Top
Mark De Lorenzo




Posts: 27
Joined: 2015-06-22
Andrei Smolin writes:

What Office build are you using?

Also, make sure *all* other COM add-ins are turned off and no macro exists in the document or in the template that the document is based on. Do you test on a saved document or on a new one?


Currently testing in Word 2013.
Using your test document you sent me.

Sorry for the delayed response. I was on vacation last week.
Posted 19 Dec, 2017 10:14:38 Top
Andrei Smolin


Add-in Express team


Posts: 14593
Joined: 2006-05-11
Hello Mark,

For me, this doesn't occur on Word 2013 15.0.4963.1002 32bit.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Dec, 2017 09:55:13 Top