首页 > Wiz, Wiz二次开发 > WizKnowledge COM对象之IWizDocument

WizKnowledge COM对象之IWizDocument


IWizDocument是WizKMCore.dll包含的一个COM对象。文档对象必须隶属于一个数据库,因此您不能直接创建这个对象,而是需要通过IWizDatabase对象来获得数据库中的文档对象。
通过IWizDatabase.GetAllDocuments,获得IWizFolder.Documents等等方法,可以获得数据库的文档信息。
 

IWizDocumenCollection是文件夹对象IWizDocumen的一个集合(数据),当需要返回一个IWizDocumen集合的时候,会返回这个对象,例如IWizFolder.Documents属性,就会返回这个对象。
这个对象实现了IEnumXXXX 接口,这样在某些语言内,可以通过fore_each来枚举集合内的每一个对象。
 
每一个IWizDocument对象,都在索引数据库(index.db)里面,包含一条记录,记录了文档的元数据,同时,还有一个磁盘文件(*.ziw),保存了文档的数据。
ziw是一个zip文件,即使没有安装WizKnowledge,您也可以用压缩软件来打开ziw文件,查看完整的html内容。因为使用了zip方式压缩,不但可以减少磁盘占用,还可以保持磁盘整洁,减少磁盘碎片,而且,即使以后您不再使用WizKnowledge文件,您的文档也不会因为没有安装WizKnowledge而无法打开。
 
WizKnowledge提供了WizViewer.exe,专门用来直接查看ziw文件。在我的电脑里面,直接双击一个ziw文件,就可以用WizViewer.exe来打开文件。另外,WizKnowledge提供了Windows Search的IFilter插件和Google Desktop的插件,可以用来对WizKnowledge来建立索引,提供桌面全文检索。
 
请不要直接删除ziw文件,因为这样会破坏数据完整性。
文档可以包含任意数量的附件。每一个附件,都对应于一个磁盘文件。附件保存在文档数据文件夹下面的XXX_Attachments文件夹内。
 
文档可以包含任意数量的自定义参数,自定义参数,主要是用来扩展WizKnowledge的功能。
 
  • 文件:WizKMCore.dll

IWizDocumentCollection是一个IWizDocument对象的集合。

[
    object,
    uuid(F8AE7F18-3C30-47D1-8902-947E5676895C),
    dual,
    nonextensible,
    helpstring("IWizDocumentCollection Interface"),
    pointer_default(unique)
]
interface IWizDocumentCollection : IDispatch{

    //生成一个新的IEnumXXXX类型的接口,可以在某些语言内使用for_each类型的语法。
    [id(DISPID_NEWENUM), propget] HRESULT _NewEnum([out, retval] IUnknown** ppUnk);

    //获得某一个对象。Index:索引值,以0开始;返回值:IWizDocument对象
    [id(DISPID_VALUE), propget] HRESULT Item([in] long Index, [out, retval] IDispatch** pVal);

    //获得集合内元素的数量
    [id(1), propget] HRESULT Count([out, retval] long * pVal);

    //添加一个文档,类型必须为IWizDocument
    [id(2), helpstring("method Add")] HRESULT Add([in] IDispatch* pDocumentDisp);
};

 

IWizDocument对象

 

[
    object,
    uuid(5B78A65E-6EE8-41C7-B1DA-8ECBF9D917B0),
    dual,
    nonextensible,
    helpstring("IWizDocument Interface"),
    pointer_default(unique)
]
interface IWizDocument : IDispatch{

    //获得文档的GUID
    [propget, id(1), helpstring("property GUID")] HRESULT GUID([out, retval] BSTR* pVal);

    //获得/设置文档的标题
    [propget, id(2), helpstring("property Title")] HRESULT Title([out, retval] BSTR* pVal);
    [propput, id(2), helpstring("property Title")] HRESULT Title([in] BSTR newVal);

    //获得/设置文档的作者
    [propget, id(3), helpstring("property Author")] HRESULT Author([out, retval] BSTR* pVal);
    [propput, id(3), helpstring("property Author")] HRESULT Author([in] BSTR newVal);

    //获得/设置文档的关键字
    [propget, id(4), helpstring("property Keywords")] HRESULT Keywords([out, retval] BSTR* pVal);
    [propput, id(4), helpstring("property Keywords")] HRESULT Keywords([in] BSTR newVal);

    //获得/设置文档的标签,类型为IWizTagCollection
    [propget, id(5), helpstring("property Tags")] HRESULT Tags([out, retval] IDispatch** pVal);
    [propput, id(5), helpstring("property Tags")] HRESULT Tags([in] IDispatch* newVal);

    //获得/设置文档的名称(对应的ziw的文件名,不包含路径)
    [propget, id(6), helpstring("property Name")] HRESULT Name([out, retval] BSTR* pVal);
    [propput, id(6), helpstring("property Name")] HRESULT Name([in] BSTR newVal);

    //获得文档在数据库中的路径。格式为/abx/def/
    [propget, id(7), helpstring("property Location")] HRESULT Location([out, retval] BSTR* pVal);

    //获得文档数据的完整路径名(ziw的完整路径名)
    [propget, id(8), helpstring("property FileName")] HRESULT FileName([out, retval] BSTR* pVal);

    //获得/设置文档在网络上面的url名称。如果文档不公开,这个数据无用
    [propget, id(9), helpstring("property SEO")] HRESULT SEO([out, retval] BSTR* pVal);
    [propput, id(9), helpstring("property SEO")] HRESULT SEO([in] BSTR newVal);

    //获得/设置文档的原始网页URL,或者磁盘文件名(导入的文件)
    [propget, id(10), helpstring("property URL")] HRESULT URL([out, retval] BSTR* pVal);
    [propput, id(10), helpstring("property URL")] HRESULT URL([in] BSTR newVal);

    //获得/设置文档的类型,例如document,note,journal,contact等等
    [propget, id(11), helpstring("property Type")] HRESULT Type([out, retval] BSTR* pVal);
    [propput, id(11), helpstring("property Type")] HRESULT Type([in] BSTR newVal);

    //获得/设置文档的所有者,默认是建立文档所在的电脑名称
    [propget, id(12), helpstring("property Owner")] HRESULT Owner([out, retval] BSTR* pVal);
    [propput, id(12), helpstring("property Owner")] HRESULT Owner([in] BSTR newVal);

    //获得/设置文档的文件类型,例如html,doc,jpg等等
    [propget, id(13), helpstring("property FileType")] HRESULT FileType([out, retval] BSTR* pVal);
    [propput, id(13), helpstring("property FileType")] HRESULT FileType([in] BSTR newVal);

    //获得/设置文档的样式,类型为IWizStyle
    [propget, id(14), helpstring("property Style")] HRESULT Style([out, retval] IDispatch** pVal);
    [propput, id(14), helpstring("property Style")] HRESULT Style([in] IDispatch* newVal);

    //获得/设置文档的图标索引,暂不支持
    [propget, id(15), helpstring("property IconIndex")] HRESULT IconIndex([out, retval] LONG* pVal);
    [propput, id(15), helpstring("property IconIndex")] HRESULT IconIndex([in] LONG newVal);

    //获得/设置文档是否进行同步,暂不支持
    [propget, id(16), helpstring("property Sync")] HRESULT Sync([out, retval] VARIANT_BOOL* pVal);
    [propput, id(16), helpstring("property Sync")] HRESULT Sync([in] VARIANT_BOOL newVal);

    //获得/设置文档的保护类型,暂不支持
    [propget, id(17), helpstring("property Protect")] HRESULT Protect([out, retval] LONG* pVal);
    [propput, id(17), helpstring("property Protect")] HRESULT Protect([in] LONG newVal);

    //获得/设置文档的阅读次数
    [propget, id(18), helpstring("property ReadCount")] HRESULT ReadCount([out, retval] LONG* pVal);
    [propput, id(18), helpstring("property ReadCount")] HRESULT ReadCount([in] LONG newVal);

    //获得文档的附件数量
    [propget, id(19), helpstring("property AtachmentCount")] HRESULT AttachmentCount([out, retval] LONG* pVal);

    //获得/设置文档是否被索引了,暂不支持
    [propget, id(20), helpstring("property Indexed")] HRESULT Indexed([out, retval] VARIANT_BOOL* pVal);
    [propput, id(20), helpstring("property Indexed")] HRESULT Indexed([in] VARIANT_BOOL newVal);

    //获得/设置文档的创建时间
    [propget, id(21), helpstring("property DateCreated")] HRESULT DateCreated([out, retval] DATE* pVal);
    [propput, id(21), helpstring("property DateCreated")] HRESULT DateCreated([in] DATE newVal);

    //获得/设置文档的修改时间
    [propget, id(22), helpstring("property DateModified")] HRESULT DateModified([out, retval] DATE* pVal);
    [propput, id(22), helpstring("property DateModified")] HRESULT DateModified([in] DATE newVal);

    //获得/设置文档的访问时间
    [propget, id(23), helpstring("property DateAccessed")] HRESULT DateAccessed([out, retval] DATE* pVal);
    [propput, id(23), helpstring("property DateAccessed")] HRESULT DateAccessed([in] DATE newVal);

    //获得文档的信息被修改的时间
    [propget, id(24), helpstring("property InfoDateModified")] HRESULT InfoDateModified([out, retval] DATE* pVal);

    //获得文档的信息md5值
    [propget, id(25), helpstring("property InfoMD5")] HRESULT InfoMD5([out, retval] BSTR* pVal);

    //获得文档的数据修改时间
    [propget, id(26), helpstring("property DataDateModified")] HRESULT DataDateModified([out, retval] DATE* pVal);

    //获得文档的数据md5值
    [propget, id(27), helpstring("property DataMD5")] HRESULT DataMD5([out, retval] BSTR* pVal);

    //获得文档的参数修改时间
    [propget, id(28), helpstring("property ParamDateModified")] HRESULT ParamDateModified([out, retval] DATE* pVal);

    //获得文档的参数md5值
    [propget, id(29), helpstring("property ParamMD5")] HRESULT ParamMD5([out, retval] BSTR* pVal);

    //获得文档的所有附件,类型为IWizDocumentAttachmentCollection
    [propget, id(30), helpstring("property Attachments")] HRESULT Attachments([out, retval] IDispatch** pVal);

    //获得/设置文档的参数。bstrParamName:参数名称,忽略大小写
    [propget, id(31), helpstring("property ParamValue")] HRESULT ParamValue([in] BSTR bstrParamName, [out, retval] BSTR* pVal);
    [propput, id(31), helpstring("property ParamValue")] HRESULT ParamValue([in] BSTR bstrParamName, [in] BSTR newVal);

    //获得文档的所有参数。类型为IWizDocumentParamCollection
    [propget, id(32), helpstring("property Params")] HRESULT Params([out, retval] IDispatch** pVal);

    //获得文档所在的文件夹,类型为IWizFolder
    [propget, id(33), helpstring("property Parent")] HRESULT Parent([out, retval] IDispatch** pVal);

    //获得/设置文档的样式GUID
    [propget, id(34), helpstring("property StyleGUID")] HRESULT StyleGUID([out, retval] BSTR* pVal);
    [propput, id(34), helpstring("property StyleGUID")] HRESULT StyleGUID([in] BSTR newVal);

    //获得/设置文档的版本,用于同步,建议不要修改,否则可能导致同步错误
    [propget, id(35), helpstring("property Version")] HRESULT Version([out, retval] LONGLONG* pVal);
    [propput, id(35), helpstring("property Version")] HRESULT Version([in] LONGLONG newVal);

    //获得/设置文档的标签文字,每一个标签之间,通过英文半角分号(;)分割。
    [propget, id(36), helpstring("property TagsText")] HRESULT TagsText([out, retval] BSTR* pVal);
    [propput, id(36), helpstring("property TagsText")] HRESULT TagsText([in] BSTR newVal);

    //获得文档的所在的数据库
    [propget, id(37), helpstring("property Database")] HRESULT Database([out, retval] IDispatch** pVal);

    //获得文档数据所在的文件夹路径,例如:D:\My Documents\My Knowledge\Data\Default\新闻\
    [propget, id(38), helpstring("property FilePath")] HRESULT FilePath([out, retval] BSTR* pVal);

    //获得文档附件所在的文件夹路径,例如:D:\My Documents\My Knowledge\Data\Default\新闻\abc_Attachments\
    [propget, id(39), helpstring("property AttachmentsFilePath")] HRESULT AttachmentsFilePath([out, retval] BSTR* pVal);

    //添加一个标签。pTagDisp:标签对象,类型为IWizTag
    [id(40), helpstring("method AddTag")] HRESULT AddTag([in] IDispatch* pTagDisp);

    //删除一个标签。pTagDisp:标签对象,类型为IWizTag
    [id(41), helpstring("method RemoveTag")] HRESULT RemoveTag([in] IDispatch* pTagDisp);

    //删除全部的文档标签。
    [id(42), helpstring("method RemoveAllTags")] HRESULT RemoveAllTags();

    //删除文档
    [id(43), helpstring("method Delete")] HRESULT Delete(void);

    //重新从数据库里面获得文档的信息。
    [id(44), helpstring("method Reload")] HRESULT Reload(void);

    //添加一个附件。bstrFileName:磁盘文件名;返回值:成功添加的附件的对象,类型为IWizDocumentAttachment
    [id(45), helpstring("method AddAttachment")] HRESULT AddAttachment([in] BSTR bstrFileName, [out,retval] IDispatch** ppNewAttachmentDisp);

    //保存为html文件。bstrHtmlFileName:保存后的html文件名;nFlags:选项,可能的值为:wizDocumentToHtmlUsingDisplayTemplate=0×01,使用现实模板。
    [id(46), helpstring("method SaveToHtml")] HRESULT SaveToHtml([in] BSTR bstrHtmlFileName, [in] LONG nFlags);

    //移动到目标文件夹。pDestFolderDisp:目标文件夹,类型为IWizFolder
    [id(47), helpstring("method MoveTo")] HRESULT MoveTo([in] IDispatch* pDestFolderDisp);

    //复制到到目标文件夹。pDestFolderDisp:目标文件夹,类型为IWizFolder;返回值:复制后的新的文档对象,类型为IWizDocument
    [id(48), helpstring("method CopyTo")] HRESULT CopyTo([in] IDispatch* pDestFolderDisp, [out,retval] IDispatch** ppNewDocumentDisp);

    //判断文档是否在一个文件夹内。pFolderDisp:目标文件夹。注意:只要文档在文件夹下面(可以多级),就返回true。例如用来判断一个文档是否在回收站内。
    [id(49), helpstring("method IsIn")] HRESULT IsIn([in] IDispatch* pFolderDisp, [out,retval] VARIANT_BOOL* pvbRet);

    //更改文档数据,通过一个html文件来更新文档。
    //wizUpdateDocumentSaveSel                = 0×0001    保存选中部分,仅仅针对UpdateDocument2有效
    //wizUpdateDocumentIncludeScript        = 0×0002    包含html里面的脚本
    //wizUpdateDocumentShowProgress        = 0×0004    显示进度
    //wizUpdateDocumentSaveContentOnly        = 0×0008   只保存正文 
    //wizUpdateDocumentSaveTextOnly        = 0×0010    只保存文字内容,并且为纯文本
    //wizUpdateDocumentDonotDownloadFile    = 0×0020    不从网络下载html里面的资源
    //wizUpdateDocumentAllowAutoGetContent    = 0×0040    如果只保存正文,允许使用自动获得正文方式
    [id(50), helpstring("method UpdateDocument")] HRESULT UpdateDocument([in] BSTR bstrHtmlFileName, [in] LONG nFlags);

    //更改文档数据,通过一个IHTMLDocument2对象来更新
    [id(51), helpstring("method UpdateDocument2")] HRESULT UpdateDocument2([in] IDispatch* pIHTMLDocument2Disp, [in] LONG nFlags);

    //更改文档数据,通过HTML文字内容来更新
    [id(52), helpstring("method UpdateDocument3")] HRESULT UpdateDocument3([in] BSTR bstrHtml, [in] LONG nFlags);

    //更改文档数据,通过HTML文字内容以及该HTML的URL来更新
    [id(53), helpstring("method UpdateDocument4")] HRESULT UpdateDocument4([in] BSTR bstrHtml, [in] BSTR bstrURL, [in] LONG nFlags);

    //更改文档数据,通过一个HTML文件名来更新。
    [id(54), helpstring("method UpdateDocument5")] HRESULT UpdateDocument5([in] BSTR bstrHtmlFileName);

    //更改文档数据,通过一个HTML文件名和对应的URL来更新。
    [id(55), helpstring("method UpdateDocument6")] HRESULT UpdateDocument6([in] BSTR bstrHtmlFileName, [in] BSTR bstrURL, [in] LONG nFlags);

    //比较两个文档,保留
    [id(56), helpstring("method CompareTo")] HRESULT CompareTo([in] IDispatch* pDocumentDisp, [in] LONG nCompareBy, [out,retval] LONG* pnRet);

    //获得文档的text内容
    [id(57), helpstring("method GetText")] HRESULT GetText([in] UINT nFlags, [out, retval] BSTR* pbstrText);

    //获得文档的html内容
    [id(58), helpstring("method GetHtml")] HRESULT GetHtml([out, retval] BSTR* pbstrHtml);

    //开始更新文档的参数
    [id(59), helpstring("method BeginUpdateParams")] HRESULT BeginUpdateParams();

    //结束更新文档的参数
    [id(60), helpstring("method EndUpdateParams")] HRESULT EndUpdateParams();

    //添加文档到日历。dtStart:开始时间;dtEnd:结束时间
    [id(61), helpstring("method AddToCalendar")] HRESULT AddToCalendar([in] DATE dtStart, [in] DATE dtEnd, [in] BSTR bstrExtInfo);

    //从日历中删除文档
    [id(62), helpstring("method RemoveFromCalendar")] HRESULT RemoveFromCalendar(void);

    //更改文档标题和文件名
    [id(63), helpstring("method ChangeTitleAndFileName")] HRESULT ChangeTitleAndFileName([in] BSTR bstrTitle);

    //获得文档的图标文件名
    [id(64), helpstring("method GetIconFileName")] HRESULT GetIconFileName([out,retval] BSTR* pbstrIconFileName);
};

 

IWizDocumentAttachmentCollection是IWizDocumentAttachment的集合

[
    object,
    uuid(9B1E33B1-C799-4F7F-8926-54A512D45635),
    dual,
    nonextensible,
    helpstring("IWizDocumentAttachmentCollection Interface"),
    pointer_default(unique)
]
interface IWizDocumentAttachmentCollection : IDispatch{

    //生成一个新的IEnumXXXX类型的接口,可以在某些语言内使用for_each类型的语法。
    [id(DISPID_NEWENUM), propget] HRESULT _NewEnum([out, retval] IUnknown** ppUnk);

    //获得某一个对象。Index:索引值,以0开始;返回值:IWizDocumentAttachment对象
    [id(DISPID_VALUE), propget] HRESULT Item([in] long Index, [out, retval] IDispatch** pVal);

    //获得集合内元素的数量
    [id(1), propget] HRESULT Count([out, retval] long * pVal);

    //添加一个附件对象,类型为IWizDocumentAttachment
    [id(2), helpstring("method Add")] HRESULT Add([in] IDispatch* pDocumentAttachmentDisp);
};

 

IWizDocumentAttachment对象,文档的附件。

[
    object,
    uuid(9368D723-8B76-45C3-9B65-BD88B0A1BE64),
    dual,
    nonextensible,
    helpstring("IWizDocumentAttachment Interface"),
    pointer_default(unique)
]
interface IWizDocumentAttachment : IDispatch{

    //获得附件的GUID
    [propget, id(1), helpstring("property GUID")] HRESULT GUID([out, retval] BSTR* pVal);

    //获得/设置附件的名称
    [propget, id(2), helpstring("property Name")] HRESULT Name([out, retval] BSTR* pVal);
    [propput, id(2), helpstring("property Name")] HRESULT Name([in] BSTR newVal);

    //获得/设置附件的描述
    [propget, id(3), helpstring("property Description")] HRESULT Description([out, retval] BSTR* pVal);
    [propput, id(3), helpstring("property Description")] HRESULT Description([in] BSTR newVal);

    //获得/设置附件的原始URL
    [propget, id(4), helpstring("property URL")] HRESULT URL([out, retval] BSTR* pVal);
    [propput, id(4), helpstring("property URL")] HRESULT URL([in] BSTR newVal);

    //获得/设置附件的文件大小,单位是字节。
    [propget, id(5), helpstring("property Size")] HRESULT Size([out, retval] LONG* pVal);

    //获得附件的信息修改日期
    [propget, id(6), helpstring("property InfoDateModified")] HRESULT InfoDateModified([out, retval] DATE* pVal);

    //获得附件的信息md5值
    [propget, id(7), helpstring("property InfoMD5")] HRESULT InfoMD5([out, retval] BSTR* pVal);

    //获得附件的数据修改日期
    [propget, id(8), helpstring("property DataDateModified")] HRESULT DataDateModified([out, retval] DATE* pVal);

    //获得附件的数据md5值
    [propget, id(9), helpstring("property DataMD5")] HRESULT DataMD5([out, retval] BSTR* pVal);

    //获得附件所属的文档
    [propget, id(10), helpstring("property Document")] HRESULT Document([out, retval] IDispatch** pVal);

    //获得附件所属的文档GUID
    [propget, id(11), helpstring("property DocumentGUID")] HRESULT DocumentGUID([out, retval] BSTR* pVal);

    //获得附件的磁盘文件名
    [propget, id(12), helpstring("property FileName")] HRESULT FileName([out, retval] BSTR* pVal);

    //获得附件的版本,用于同步,保留
    [propget, id(13), helpstring("property Version")] HRESULT Version([out, retval] LONGLONG* pVal);
    [propput, id(13), helpstring("property Version")] HRESULT Version([in] LONGLONG newVal);

    //删除附件
    [id(14), helpstring("method Delete")] HRESULT Delete(void);

    //重新从数据库中获得附件信息
    [id(15), helpstring("method Reload")] HRESULT Reload(void);

    //更新附件的数据md5值。
    [id(16), helpstring("method UpdateDataMD5")] HRESULT UpdateDataMD5(void);
};

 

IWizDocumentParam对象。每一个文档,都可以包含任意条自定义参数。自定义参数,可以用来完成各种扩展功能,尤其是进行二次开发的时候,会比较多的用到文档参数。

文档参数也会和服务器同步。

IWizDocumentParamCollection是IWizDocumentParam对象的集合。

[
    object,
    uuid(8DB6192A-1C66-4DD0-ABD4-E80C12969A13),
    dual,
    nonextensible,
    helpstring("IWizDocumentParamCollection Interface"),
    pointer_default(unique)
]
interface IWizDocumentParamCollection : IDispatch{

    //生成一个新的IEnumXXXX类型的接口,可以在某些语言内使用for_each类型的语法。
    [id(DISPID_NEWENUM), propget] HRESULT _NewEnum([out, retval] IUnknown** ppUnk);

    //获得某一个对象。Index:索引值,以0开始;返回值:IWizDocumentParam对象
    [id(DISPID_VALUE), propget] HRESULT Item([in] long Index, [out, retval] IDispatch** pVal);

    //获得集合内元素的数量
    [id(1), propget] HRESULT Count([out, retval] long * pVal);
};

 

IWizDocumentParam对象

[
    object,
    uuid(46C5786E-A72E-4089-B4DB-70B3DD174FEB),
    dual,
    nonextensible,
    helpstring("IWizDocumentParam Interface"),
    pointer_default(unique)
]
interface IWizDocumentParam : IDispatch{

    //文档参数名称
    [propget, id(1), helpstring("property Name")] HRESULT Name([out, retval] BSTR* pVal);

    //文档参数的值
    [propget, id(2), helpstring("property Value")] HRESULT Value([out, retval] BSTR* pVal);

    //获得param所附属的文档
    [propget, id(3), helpstring("property Document")] HRESULT Document([out, retval] IDispatch** pVal);

    //删除这个参数
    [id(4), helpstring("method Delete")] HRESULT Delete(void);
};

 


分类: Wiz, Wiz二次开发 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.

Spam Protection by WP-SpamFree