您的位置:程序门 -> .net技术 -> vc.net



用vc调用word建立文档的目录 


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


用vc调用word建立文档的目录 [无满意答案结贴,结贴人:srg777]
发表于:2008-03-09 22:05:59 楼主
_application m_wordapp;
m_wordapp.createdispatch("word.application");
m_wordapp.setvisible(true);


_document m_worddoc;
m_worddoc=m_wordapp.getactivedocument();

range m_worrange;

colevariant start((short)0),end((short)0);
m_worrange =m_worddoc.range(&start,&end);

tablesofcontents m_wordtabof;
m_wordtabof = m_worddoc.gettablesofcontents();

colevariant useheadingstyles((short)true),
upperheadinglevel((short)1),
lowerheadinglevel((short)3),
usefields((short)false),
tableid(""),
rightalignpagenumbers((short)true),
includepagenumbers((short)true),
addedstyles(""),
usehyperlinks((short)false),
hidepagenumbersinweb((short)true),
useoutlinelevels((short)true);

m_wordtabof.add(m_worrange,&useheadingstyles,&upperheadinglevel,&lowerheadinglevel,
&usefields,&tableid,&rightalignpagenumbers,&includepagenumbers,&addedstyles,&usehyperlinks,
&hidepagenumbersinweb,&useoutlinelevels);


以上是一段用 vc写的代码,编译通过,执行也没提示错误,就是不在word里建立目录,word里有现成的文章。

不知道问题出在哪里!


快速检索

最新资讯
热门点击