My project is to generate word documents which is in the server. If I click the generate button, a word document will be generated where the file will be copied to a new document.
The issue I am facing here is , when i click generate and if some one else is also trying to use the portal to generate a document, then they ll get a message like "The file is already opened by someone else". and if they open after a mins, then they ll be able to copy the file..
This is the code i used ..
public void UpdateTOC(string file1, string file2)
using (var mainDoc = WordprocessingDocument.Open(file1, false))
using (var resultDoc = WordprocessingDocument.Create(file2, WordprocessingDocumentType.Document))
foreach (var part in mainDoc.Parts) resultDoc.AddPart(part.OpenXmlPart, part.RelationshipId);
Now, I don want that message to display. Is there anyother option to overcome such an issue.. Any other code snippets would also be helpfull..