Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.
Tue May 17, 2016 7:50 am
Does the document object in sprie.doc support redo and undo operation? For example , before I insert a paragraph, into a document i create a Restore Point ,and after inserting a paragarph to the document ,I want to restore the document just link that it
has never changed. How to do it?
Thnak you !
-
iceblueDDX123
-
- Posts: 34
- Joined: Tue Apr 19, 2016 9:43 am
Tue May 17, 2016 7:58 am
Hi,
Sorry that our Spire.Doc doesn't support redo. But you can use Document oldDoc= doc.Clone() to save a duplicate of the old document object.
Best Regards,
Amy
E-iceblue support team
-
amy.zhao
-
- Posts: 2766
- Joined: Wed Jun 27, 2012 8:50 am
Tue May 17, 2016 8:27 am
amy.zhao wrote:Hi,
Sorry that our Spire.Doc doesn't support redo. But you can use Document oldDoc= doc.Clone() to save a duplicate of the old document object.
Best Regards,
Amy
E-iceblue support team
doc.Clone() is a shallow copy ,that is ,when i modify the oldDoc,the doc will change .
-
iceblueDDX123
-
- Posts: 34
- Joined: Tue Apr 19, 2016 9:43 am
Tue May 17, 2016 8:42 am
Hi,
I did a testing for
doc.Clone() but I think it works.
Here is my testing code,
- Code: Select all
//Create a document
Document oldDoc = new Document();
Section section1 = oldDoc.AddSection();
section1.AddParagraph().AppendText("This is the old documnent.");
//Clone document
Document newDoc = oldDoc.Clone();
Section section2 = newDoc.Sections[0];
//Do some changes
Paragraph p = section2.AddParagraph();
p.AppendText("This is a new paragraph.");
oldDoc.SaveToFile("old.docx", FileFormat.Docx2010);
newDoc.SaveToFile("new.docx", FileFormat.Docx2010);
Here is my results.
The content of old document :
old.png
The content of new document:
new.png
Could you please share your testing documents and code for investigation?
Thank you.
Best Regards,
Amy
E-iceblue support team
Login to view the files attached to this post.
-
amy.zhao
-
- Posts: 2766
- Joined: Wed Jun 27, 2012 8:50 am
Wed May 18, 2016 1:31 am
Thank you very much! Now i need a shallow copy .
-
iceblueDDX123
-
- Posts: 34
- Joined: Tue Apr 19, 2016 9:43 am
Wed May 18, 2016 1:39 am
Hi,
You are welcome. Welcome to feel free to contact us if you have further problems.
Best Regards,
Amy
E-iceblue support team
-
amy.zhao
-
- Posts: 2766
- Joined: Wed Jun 27, 2012 8:50 am