Re: stg_e_filenotfound

I wonder if you could help. I’m trying to open a Word Document using Aspose and receive the following error message:

An unhandled exception of type ‘System.Runtime.InteropServices.COMException’

occurred in mscorlib.dll

Additional information: Exception from HRESULT: 0x80030002(STG_E_FILENOTFOUND).

The problem was caused by one structured storage streams missing in the file (all documents I saw before had that stream), probably the doc was created by some 3rd party software.

This is now fixed in Aspose.Word 1.7.2.

Hi Roman,

Firstly thank you for your help with my previous problem. The fix you posted on the website worked like a charm, however we’ve now got another problem which I think may be related to my previous problem.

When opening the document that I previously had a problem with, making a change using Aspose.Word and then attempting to save (using doc.save(filename, SaveFormat.FormatDocument) I get a “NullReference.Exception” error.



Below is the code I am using:

const String newDoc = “D:\TestDoc.doc”;

const String saveDoc = “D:\EndFile.doc”;

Word para = new Word();

Document MasterDoc = para.Open(newDoc);

DocumentBuilder docBuild = new DocumentBuilder(MasterDoc);

docBuild.MoveToBookmark(“Bookmark1”);

docBuild.Write(“Anything”);

MasterDoc.Save(saveDoc,SaveFormat.FormatDocument);

Hi,

I tried your document and your code - it all works fine. Please double check you sent the actual problem document. Also, please download the latest Aspose.Word 1.7.4 and make sure your project is using it.

Roman,

Thanks for your reply. I was using 1.7.1 (which was strange because I upgraded to 1.7.2 after the last problem).

I’m now using 1.7.4 and I’m still getting the same problem.

An unhandled exception of type ‘System.NullReferenceException’ occurred in aspose.word.dll

Additional information: Object reference not set to an instance of an object.

I’ve tried saving the document from an e-mail to see if Outlook did any jiggery-pokery that would remove the problem when you recieved my file but that didn’t change it and I’m still getting the error.

Is there anything else you can suggest? Since the problem is occurring in aspose.word.dll I can’t look at the code, and we’ve got this exact same problem occurring on 2 developer machines at the moment.

It’s breaking on…



private void Form1_Load(object sender, System.EventArgs e)

{

const String newDoc = “C:\TestDoc.doc”;

const String saveDoc = “C:\EndFile.doc”;

Word para = new Word();

Document MasterDoc = para.Open(newDoc);

DocumentBuilder docBuild = new DocumentBuilder(MasterDoc);

docBuild.MoveToBookmark(“Bookmark1”);

docBuild.Write(“Anything”);

MasterDoc.Save(saveDoc,SaveFormat.FormatDocument);

}//This line


I’m guessing this is problem during the save.

I’ve also just checked my D:\ drive for EndFile.doc and the document exists however when I try to open it in MS Word it says:

'The document name or path is not valid. Try these suggestions.
* Check the file permissions for the document or drive
* Use the File Open dialog box to locate the document (C:\EndFile.doc)'

I dunno if this helps any more?

Thanks for your help

Kurt

On rare occassions, when customers try to download the latest version, their web or proxy cache gives them the old version. In this case, you can only make sure you run Aspose.Word 1.7.4 if you right click on Aspose.Word.dll and select Properties/Version.

I guess we just have to try this one more time. I will send you correct Aspose.Word.dll and you can send me the file that throws the exception one more time.

Fixed this in Aspose.Word 1.7.5, https://forum.aspose.com/t/130011