Ole word表格中边框和纹底的设置
int nRow = 3; // 行
int nCol = 6; // 列
Variant vTable = vDoc.OlePropertyGet("Tables").OleFunction("Add",vSelect.OlePropertyGet("Range"), nRow, nCol);
表格绘制后 我发现这些表格都是没有边框的, 还有就是单元格的纹底怎么设置?
word OLE 边框纹底
[解决办法]
OLE专业户来也!!!
代码很简单,就不解释了,自己看效果。
int nRowCount = 3;
int nColCount = 6;
vDoc.OlePropertyGet("Tables").OleProcedure("Add",
vSelect.OlePropertyGet("Range"),
nRowCount, // DDêy
nColCount, // áDêy
1, // DefaultTableBehavior:=wdWord9TableBehavior
0); // AutoFitBehavior:=wdAutoFitFixed
Variant vTable = vWordApp.OlePropertyGet("ActiveDocument").
OleFunction("Range").OlePropertyGet("Tables").OleFunction("Item", 1);
Variant vCell1 = vTable.OleFunction("Cell", 2, 3);
vCell1.OlePropertyGet("Shading").OlePropertySet("BackgroundPatternColor", 0xFF);
Variant vCell2 = vTable.OleFunction("Cell", 1, 5);
vCell2.OlePropertyGet("Shading").OlePropertySet("BackgroundPatternColor", 0xFF00);
Variant vCell3 = vTable.OleFunction("Cell", 3, 1);
vCell3.OlePropertyGet("Shading").OlePropertySet("BackgroundPatternColor", 0xFF0000);