65,187
社区成员




void yema()
{
Pane mPane; //定义当前窗格对象
mWindowActive=wordApp.GetActiveWindow(); //获得当前窗口
mPane=mWindowActive.GetActivePane(); //获得当前窗格
mViewActive=mPane.GetView(); //获得当前视图
mViewActive.SetSeekView(10); //设置页脚视图
wordF = wordSelection.GetParagraphFormat();
wordF.SetAlignment(1); //居中
//wordSelection.TypeText("第 页,共19页 ");
//wordSelection.TypeText("第 页,共19页 ");
Fields fields1 = wordSelection.GetFields();
fields1.Add( wordSelection.GetRange(),COleVariant(short(33)),COleVariant("PAGE "),vfalse); //增加页码域
mViewActive.SetSeekView(0); //回到正文视图
}
namespace qi = boost::spirit::qi;
还有在{}里面用using namespace XXX,这样using的作用范围只局限在{}里。还有就是直接把命名空间里的对象释放出来
using boost::spirit::space; //这样space直接表示boost::spirit::space
class Fields : public COleDispatchDriver
{
public:
Fields() {} // Calls COleDispatchDriver default constructor
Fields(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
Fields(const Fields& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
long GetCount();
long GetLocked();
void SetLocked(long nNewValue);
LPUNKNOWN Get_NewEnum();
LPDISPATCH Item(long Index);
void ToggleShowCodes();
long Update();
void Unlink();
void UpdateSource();
LPDISPATCH Add(LPDISPATCH Range, VARIANT* Type, VARIANT* Text, VARIANT* PreserveFormatting);
};
下面是yema函数所在cpp文件的所有引用
#include "stdafx.h"
#include "comdef.h"
#include "msword.h"
#include "数据库3.h"
#include "数据库3Dlg.h"
#include <string.h>
#include <winsock.h>
#include <iostream>
using namespace std ;
#include <string>
谢谢大家了,本人菜鸟