Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

weired error with doc file to extract text from it with some method.

$
0
0

Hi All,

i am having a trouble with the below method

 if (GetDocText.Native.NativeMethods.StgIsStorageFile(this._Path) != 0)

the above method always sometimes returns either 1 or 0 zero.

in my case for the .doc file it sholud always return zero (0) so the above condition checking for if will get false and the next statement will work.

Below is definition of the StgIsStorageFile method

using System;
using System.Runtime.InteropServices;

namespace GetDocText.Native
{
    internal class NativeMethods
    {
        private NativeMethods() { }

        const string Ole32Dll = "ole32.dll";

        [DllImport(Ole32Dll, CharSet = CharSet.Unicode)]
        public static extern int StgOpenStorage(string pwcsName, IStorage pstgPriority, int grfMode, IntPtr snbExclude, int reserved, out IStorage ppstgOpen);

        [DllImport(Ole32Dll, CharSet = CharSet.Unicode)]
        public static extern int StgIsStorageFile(string pwcsName);
    }
}

as this is from the metadata file as i do no have actual source of the methods in this .

as this is for the operation on the document file processing that too .doc file,

please kindly elaborate me the possible cause of the method is not working properly.

if more information required please let me know.


Viewing all articles
Browse latest Browse all 11571

Trending Articles