bcb ole操作word解决方案
bcb ole操作word
vWordApp.OlePropertyGet("Documents").OleFunction("Add");
Variant vSelect = vWordApp.OlePropertyGet("Selection");
vSelect.OleProcedure("TypeText", "编号"+gmNum.c_str());
大家好 在下菜鸟 想用ole在bcb中操作word 我复制了老妖的部分代码 之后发现上面的代码的最后一句不正确 只要将+gmNum.c_str()这一部分去掉 就ok了 请问 这是为什么啊?字符串不能相加吗??
我的gmNum 是一个AnsiStrnig类型的变量
------解决方案--------------------
OLE专业户来也!!!
vWordApp.OlePropertyGet("Documents").OleFunction("Add");
Variant vSelect = vWordApp.OlePropertyGet("Selection");
vSelect.OleProcedure("TypeText", "编号"+gmNum.c_str());
大家好 在下菜鸟 想用ole在bcb中操作word 我复制了老妖的部分代码 之后发现上面的代码的最后一句不正确 只要将+gmNum.c_str()这一部分去掉 就ok了 请问 这是为什么啊?字符串不能相加吗??
我的gmNum 是一个AnsiStrnig类型的变量
------解决方案--------------------
OLE专业户来也!!!
Variant vSelect = vWordApp.OlePropertyGet("Selection");
Variant vTable = vWordApp.OlePropertyGet("ActiveDocument")
.OlePropertyGet("Tables").OleFunction("Add",
vSelect.OlePropertyGet("Range"),
nRowCount,
nColCount, // 列数
1, // DefaultTableBehavior:=wdWord9TableBehavior
0); // AutoFitBehavior:=wdAutoFitFixed
Variant vCell = vTable.OleFunction("Cell", 1, 3);
vCell.OlePropertySet("Range", WideString("年龄(周)"));