Aug 14, 2011 at 11:43 PM
Edited Aug 14, 2011 at 11:44 PM
This is a basic example of the problem I have:
A program loads a document in the memory when it starts (to avoid loading it multiple times later)
It then creates a temporary copy of that document, makes a change in it and saves it in a file.
After that it creates a temporary copy of that document, makes change in it and saves it in another file.
It seems simple enough but how to do that in practice?
This is a simplified version of the code I have now (doesn't work):
DocX document = DocX.Load("C:\\file.docx");
using (DocX temp = document) // copy reference
// make changes and save (this also changes "document" because temp=document!)
} // dispose temp (and document!)
using (DocX temp = document) // crash, can't find document
// make changes and save
A solution would be to save a copy of the document and then load that to the temp, and then do the same for the other one.
But I really don't want to save/load all the time... Way too slow
Is it possible or do we need a new method in the library? (tried InsertDocument() but that works very bad with images)