读书人

BCB 统制插入WORD图片的大小

发布时间: 2013-01-08 14:02:14 作者: rapoo

BCB 控制插入WORD图片的大小
vSelect.OlePropertyGet("inlineshapes").OleFunction("AddPicture",(ExtractFilePath(ParamStr(0))+"Image_A.jpg").c_str(),false,true);这是我插入图片的语句,但是不知道怎么控制大小,在线等,
[解决办法]
OLE专业户来也!!!

Variant vWordApp;
try
{
vWordApp = Variant::CreateObject("Word.Application");
}
catch(...)
{
MessageBox(Handle, "启动Word出错!",
Application->Title.c_str(), MB_OK
[解决办法]
MB_ICONERROR);

return;
}

vWordApp.OlePropertySet("Visible", true);

WideString strDocName = "D:\\ccrun\\123.doc";
Variant vDoc = vWordApp.OlePropertyGet("Documents").
OleFunction("Open", strDocName);

WideString strPicFile = "D:\\ccrun\\123.jpg";
Variant vShape = vWordApp.OlePropertyGet("Selection")
.OlePropertyGet("InlineShapes").OleFunction("AddPicture", strPicFile, false, true);

// 设置图片宽100,高100
vShape.OlePropertySet("Width", 100);
vShape.OlePropertySet("Height", 100);

读书人网 >C++ Builder

热点推荐