Access中创建含有OLE对象列的表

创建/ 查询设计 /SQL视图 

到这里才可以输入SQL语句。

OLE对象在SQL语句中的类型为 IMAGE

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要在 Word 添加 OLE 对象,可以使用 Java 的 COM Bridge 组件,通过调用 Word 的 COM 接口实现。 以下是一个示例代码,演示如何在 Word 添加 Excel 格: ```java import com.jacob.activeX.ActiveXComponent; import com.jacob.com.Dispatch; import com.jacob.com.Variant; public class WordOLE { public static void main(String[] args) { ActiveXComponent word = new ActiveXComponent("Word.Application"); word.setProperty("Visible", new Variant(true)); Dispatch documents = word.getProperty("Documents").toDispatch(); Dispatch document = Dispatch.call(documents, "Add").toDispatch(); Dispatch selection = Dispatch.get(word, "Selection").toDispatch(); // 添加 OLE 对象 Dispatch shapes = Dispatch.get(selection, "Shapes").toDispatch(); Dispatch oleObject = Dispatch.call(shapes, "AddOLEObject", "Excel.Sheet", "C:\\example\\example.xlsx", false, false, "", 0, "", 0).toDispatch(); // 调整 OLE 对象的位置和大小 Dispatch frame = Dispatch.get(oleObject, "Anchor").toDispatch(); Dispatch.call(frame, "Select"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveRight"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(selection, "MoveDown"); Dispatch.call(frame, "Select"); Dispatch.call(oleObject, "Activate"); // 保存并关闭文档 Dispatch.call(document, "SaveAs", "C:\\example\\example.docx"); Dispatch.call(document, "Close", new Variant(false)); Dispatch.call(word, "Quit"); } } ``` 在这个例子,我们使用了 jacob 库来调用 COM 接口。首先,我们打开 Word 应用程序并创建一个新文档。然后,我们获取当前的选区并在其添加 OLE 对象。接下来,我们使用选区调整 OLE 对象的位置和大小,然后激活它以确保它能够正常工作。最后,我们保存并关闭文档,并退出 Word 应用程序。 请注意,在此过程,我们需要提供 Excel 格的路径和类型。在本例,我们将路径设置为 "C:\\example\\example.xlsx",并将类型设置为 "Excel.Sheet"。您需要根据您的情况进行更改。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值