问题,原先在用WordApplication 可以完成对word的控制现在好像不行了。为了此问题我曾想通过delphi 2009 找到答案,可2009里仍然最封装了officeXP。
具体问题如下:
for i := 1 to WordApplication1.CommandBars.Count do
begin
for j := 1 to WordApplication1.CommandBars.Item[i].Controls.Count do
begin
try
b := WordApplication1.CommandBars.Item[i].Controls.Item[j];
if b.Id=109 then
begin //打印预览按钮
f:= b.Enabled;
b.Set_Enabled(not f);
end;
except
Continue;
end;
end;
end;
原本用以上代码可以将WORD的打印预览按钮置灰,现在在WORD2007里已经不再管用了。 不清楚office 2007 在这方面作了什么样的调整。
具体问题如下:
for i := 1 to WordApplication1.CommandBars.Count do
begin
for j := 1 to WordApplication1.CommandBars.Item[i].Controls.Count do
begin
try
b := WordApplication1.CommandBars.Item[i].Controls.Item[j];
if b.Id=109 then
begin //打印预览按钮
f:= b.Enabled;
b.Set_Enabled(not f);
end;
except
Continue;
end;
end;
end;
原本用以上代码可以将WORD的打印预览按钮置灰,现在在WORD2007里已经不再管用了。 不清楚office 2007 在这方面作了什么样的调整。
所以期待着CodeGear 早点出office2007 的版本!
网上能找到Add-in Express 2007 for VCL的Full Source
很好用,拖Ribbon组件来做就行了,^_^
如果需要兼容多个版本,需要Ribbon和CommandBar各做一套命令功能控件价格也不算贵,我觉得一般的公司也能接受的
出品公司的技术支持做得很好,值得一试XD 最近写Office Add-in写到抽风的某只飘过……
除了CreateOleObject外好像没有办法调用office2009里的新方法了(比如给table套一个style)