Bookmarks disappearing

P

Peter Karlström

Hi

I have a very strange problem which I at first thought was caused by my
COM-Addin. But now, even if I unregister the COM Addin the problem persists.

Word 2007 automatically deletes bookmarks from my documents pagefooter.
I have a document with about 20 bookmarks, of which some are placed in
PrimaryPageFooter and Footer and others in FirstPageHeader and Footer.
If I open the document and edit it with som letters and then save it, the
bookmarks are still there. If I then close the document and reopens it, the
bookmarks are gone.
No Addins what so ever is installed in this environment other than Microsoft
Office standard components.

I have testdocuments before and after if anybody wants to take a look.

Can this be a Word bug?

Regards
 
J

Jialiang Ge [MSFT]

Hello Peter,

I queried the symptom that "bookmarks in header/footer disappear after
reopening the document" in our internal database, and found a report that
said, bookmarks at the beginning of header would be lost after roundtrip
through XML. The attached repro-steps to the report is:

1. Open blank word document.
2. View --> Header / Footer
3. Insert --> Picture --> From File (Select an image)
4. Make sure your IP is before the image.
5. Insert --> Bookmark "foo" --> Add
6. Save as XML.
7. Close and reopen file.
8. Insert --> Bookmark.

RESULT
Bookmark "foo" is gone.

According to the log, the product team confirmed this only happens to XML
format of the word document. It does not interfere with the use of docx.

Peter, does your document have the same features as the above? If not,
would you send your test documents to my mailbox: (e-mail address removed)? I
cannot reproduce the symptom with a simple docx, so maybe your test
documents can help me have a clearer picture.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Karlström

Hello Jialiang Ge

It seems that the cause of the problem is the way I "populate" the bookmarks
with text in the COM Addin code.
It looks as if I don't manage to place the text within the bookmarks start
and end tags.

My scenario is that the document is preconfigured with empty bookmarks. I
read data from a database where I get the bookmark name, and the text which
is to be placed in the document.
Can you show a sample of how to accomplish this the correct way, I'll be
most greatful.

Thanks in advance

Best Regards
--
Peter Karlström
Midrange AB
Sweden


"Jialiang Ge [MSFT]" said:
Hello Peter,

I queried the symptom that "bookmarks in header/footer disappear after
reopening the document" in our internal database, and found a report that
said, bookmarks at the beginning of header would be lost after roundtrip
through XML. The attached repro-steps to the report is:

1. Open blank word document.
2. View --> Header / Footer
3. Insert --> Picture --> From File (Select an image)
4. Make sure your IP is before the image.
5. Insert --> Bookmark "foo" --> Add
6. Save as XML.
7. Close and reopen file.
8. Insert --> Bookmark.

RESULT
Bookmark "foo" is gone.

According to the log, the product team confirmed this only happens to XML
format of the word document. It does not interfere with the use of docx.

Peter, does your document have the same features as the above? If not,
would you send your test documents to my mailbox: (e-mail address removed)? I
cannot reproduce the symptom with a simple docx, so maybe your test
documents can help me have a clearer picture.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

Cindy M.

Hi Peter,
It seems that the cause of the problem is the way I "populate" the bookmarks
with text in the COM Addin code.
It looks as if I don't manage to place the text within the bookmarks start
and end tags.

My scenario is that the document is preconfigured with empty bookmarks. I
read data from a database where I get the bookmark name, and the text which
is to be placed in the document.
Can you show a sample of how to accomplish this the correct way, I'll be
most greatful.
The approach I use looks like this:

Dim sBkmName as String
Dim rngBkm as Word.Range
sBkmName = "abc"
If oDoc.Bookmarks.Exists(sBkmName) Then
Set rngBkm = oDoc.Bookmarks(sBkmName)
rngBkm.Text = "new text"
oDoc.Bookmarks.Add(rngBkm, sBkmName)
End If

Putting the text into the bookmark deletes the bookmark if it contains
anything. If the bookmark is a "point", the bookmark will not surround the new
text. So in either case, recreate the bookmark around the range containing the
new text.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
P

Peter Karlström

Hi

Thank you Cindy. I have tested this and will use this approach in my project.

I also found out that some of the predefined bookmarks (which are loaded
from Autotext-entries) was incorrectly designed for my purposes.
With this corrected and some minor adjustments in the bookmark contents
handling (from your sample), everything now seems to work fine.

Regards
 
J

Jialiang Ge [MSFT]

Thank you Cindy, for the sharing of this creative resolution.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 

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