LibreOffice SDK的VB.Net示例 [英] VB.Net example for LibreOffice SDK

查看:508
本文介绍了LibreOffice SDK的VB.Net示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WriterDemo示例使用VB.NET与UNO API. (file:///C:/Program Files/LibreOffice 5/sdk/examples/CLI/VB.NET/WriterDemo/中的 SDK 下载中也包含这些文件.)

The WriterDemo example uses VB.NET to interact with the UNO API. (The files are also included with the SDK download in file:///C:/Program Files/LibreOffice 5/sdk/examples/CLI/VB.NET/WriterDemo/.)

要构建和运行,我根据 https://api设置了命令行环境.libreoffice.org/docs/install.html ,然后使用make WriterDemo.run执行Makefile.但它在此行崩溃:

To build and run, I set up the command line environment according to https://api.libreoffice.org/docs/install.html, and then executed the Makefile using make WriterDemo.run. But it crashes on this line:

xContext = Bootstrap.bootstrap()

错误消息:

Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at cppu.bootstrap(Reference<com::sun::star::uno::XComponentContext>* )
   at uno.util.Bootstrap.bootstrap()
   at WriterDemo.Main()
make: *** [WriterDemo.run] Error -1066598274

这是问题推荐答案

使用Visual Studio代替Makefile.

Use Visual Studio instead of the Makefile.

  • Start a new Visual Basic Console Application.
  • Paste the code from WriterDemo.vb into Module1.vb. Rename Module1.vb to WriterDemo.vb by right-clicking on the file in Solution Explorer.
  • In Project Properties, change Startup object to WriterDemo.
  • Right-click on References and choose Add References. Browse to the cli folder in the SDK, for example C:\Program Files (x86)\LibreOffice 5\sdk\cli. (The files in the GAC did not work for me.)
  • Select all 5 files from that folder and press Add. Then be sure that there is a check mark in each of their boxes.
  • Modify App.config to fix the loading problem as described here.
  • To avoid a warning, set the processor architecture to x86 as described here.
  • It may also be necessary to set UNO_PATH, although it worked for me without doing this.

现在按工具栏中的Start(或调试"->开始调试").如果一切顺利,它将启动LibreOffice并将一些内容插入Writer.

Now press Start in the toolbar (or Debug -> Start Debugging). If all goes well, it will start LibreOffice and insert some content into Writer.

描述VB 2005的旧示例位于 https ://forum.openoffice.org/en/forum/viewtopic.php?f = 20& t = 21494 .

An older example describing VB 2005 is at https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=21494.

感谢@Zev Spitz提供的提示和更正.

Thanks to @Zev Spitz for hints and corrections.

这篇关于LibreOffice SDK的VB.Net示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆