Hi,
I am having trouble viewing a generated document soon after it had been generated by Aspose.Word. I get the following error:
The requested resource is in use.
at SHDocVw.IWebBrowser2.Navigate(String URL, Object& Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at AxSHDocVw.AxWebBrowser.Navigate(String uRL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
at PrintManager.frmView.NavigateFirst()
I am using AxWebbrowser control to navigate to this new page. I have this code at the end of the document generating code:
FileStream fs=null;
fs = new FileStream(oTemplate.ToString(), FileMode.Open, FileAccess.Read);
oDoc = new Document(fs);
if(oDoc.ProtectionType != ProtectionType.NoProtection)
oDoc.Unprotect();
FillData();
oDoc.Protect(ProtectionType.AllowOnlyFormFields);
oDoc.Save(oName.ToString(), SaveFormat.FormatDocument);
oDoc=null;
if(oDoc!=null) oDoc=null;
if(fs!=null) fs.Close(); // closes template file
And here's the NavigateFirst() method I am using:
public void NavigateFirst()
{
if(!navigated && dvDocs.Count > 0 && this.InputFinished)
{
try
{
wbDocs.Navigate(sDir + dvDocs[0]["GFileName"], ref oMissing, ref oMissing, ref oMissing, ref oMissing);
// navigate to first document, after atleast one is generated
this.navigated = true;
}
catch()
{
}
}
}
Is there a way to make sure the generated document is closed completely using Aspose.Word? How come there isn't a Document.Close() method?
Thanks for your help.
piddy
ORTICON