Join
Sign in
Search Options
Search Everything
Search Formats
Home
Blog
Resources
Forums
About Open XML
More ...
Home
»
Forums
»
Formats
»
WordprocessingML
»
Using Track Revisions while removing elements from a document
Using Track Revisions while removing elements from a document
Formats
Discussions about working with different Open XML Formats
Get this RSS feed
Details
3
Replies
1
Subscriber
Posted
over 2 years ago
Options
Subscribe via RSS
Share this
WordprocessingML
Using Track Revisions while removing elements from a document
rated by 0 users
This post has
3 Replies |
1
Follower
RML604
90
Posted by
RML604
on
Fri, Mar 5 2010 1:11 PM
rated by 0 users
Post Points: 20
Using Track Revisions while removing elements from a document
I have a document that I'm loading into memory and I want to remove some of the elements from the document. However, I want to use Track Revisions so that the elements aren't actually removed, they're just struck through and then later somebody can accept those changes. So I'm reading the document into memory, adding a new TrackRevisions element with Val = BooleanValues.True to the Settings collection, calling document.MainDocumentPart.DocumentSettingsPart.Settings.Save(), and then removing my elements by calling myElement.Remove(); Unfortunately, when I then save the document back to the file system and open it in word, the elements have been completely removed from the document instead of being struck through.
Does anybody know what I'm doing wrong? Is it possible to use TrackRevisions while modifying the document pro grammatically? I will be needing to add and remove elements to the document, is there a special way that I need to add and remove them for TrackRevisions to work?
Thanks!
Intergen
2610
Posted by
Intergen
on
Sun, Apr 18 2010 5:28 PM
rated by 0 users
Post Points: 20
Re: Using Track Revisions while removing elements from a document
Hi there
I think this might be the issue, once you finish reading the file into memoryStream, the cursor will be set to the end.
So try to set the position of the curosr of the streamwriter to 0 then try it again.
Cheers
RML604
90
Posted by
RML604
on
Mon, Apr 19 2010 12:14 PM
rated by 0 users
Post Points: 5
Re: Using Track Revisions while removing elements from a document
I'm not sure I understand exactly what you mean? Can you clarify a bit?
Thanks!
RML604
90
Posted by
RML604
on
Mon, May 3 2010 11:40 AM
rated by 0 users
Post Points: 5
Re: Using Track Revisions while removing elements from a document
From what I can tell, this isn't possible. I created a Word document manually and turned Track Changes on in the document. I then created a program to read in that document, delete the first paragraph, and save it back to the file system.
When I run my program and then reopen the document, Track Changes is still on but the first paragraph has been removed entirely instead of being struck through.
Does anybody have any other suggestions on what to try? Is there something I need to do instead of calling .Remove() on the element?
Page 1 of 1 (4 items)