最近工作中遇到在swt程序中打开word文件,
察看了文档后OleClientSite能够实现这个功能,可是就是不能实现滚动条,
有哪位大哥了解这方面的帮小弟一忙。
代码:
    private File showfile;
    OleFrame oleFrame;
    OleClientSite clientSite;
    oleFrame = new OleFrame(composite, SWT.NULL);
    oleFrame.setLayout(new FillLayout());
    clientSite = new OleClientSite(oleFrame,          SWT.NULL,"Word.Document.8",showfile);
    clientSite.doVerb(OLE.OLEIVERB_SHOW);   我试着在oleFrame = new OleFrame(composite, SWT.NULL);加了SWT.V_SCOLL
滚动条出现,但拖动滚动条,word文件不随着动。
我又试着在new OleClientSite(oleFrame,SWT.NULL,"Word.Document.8",showfile);
加了SWT.V_SCOLL,出现的情况也是一样。

解决方案 »

  1.   

    这个问题解决了么?我也遇到这个问题了,折腾了半天,还是没有找到较好的解决办法。只能通过添加ScrolledComposite实现,可是这样子就把高度写死了。
    ScrolledComposite composite = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    composite.setBounds(0, 0, 760, 500);
    composite.setLayoutData(gd);
    OleFrame oleFrame=new OleFrame(composite,SWT.NONE);
    composite.setContent(oleFrame);
    composite.setMinSize(760,4);
    oleFrame.setSize(760,18000);