首页 \ 问答 \ c#:在MergeField Word中插入图像(c# : Insert Image in MergeField Word)

c#:在MergeField Word中插入图像(c# : Insert Image in MergeField Word)

我知道如何在Micorsoft Word中的mergeField中添加programmaticaly文本,使用: https ://vivekcek.wordpress.com/2012/08/25/create-a-word-document-from-a-template-using-c- 邮件合并/

但是,我想要的是添加图像。 可能吗 ? 如果没有,我如何将图像插入预定位置(在Word模板中)?

谢谢


I know how to programmaticaly add text in mergeField in Micorsoft Word, using this : https://vivekcek.wordpress.com/2012/08/25/create-a-word-document-from-a-template-using-c-mail-merge/

But, what I want is to add an image. Is it possible ? If not, how can I insert an image to a pre-defined position (in a Word template) ?

Thanks


原文:https://stackoverflow.com/questions/29104578
更新时间:2024-01-07 11:01

最满意答案

你没有说明你正在使用哪个反应堆,但是这个页面ReactorBase是反应堆的基类。

同样在同一页面上,它提到了一个实例变量的running这里会进一步解释。

它说

running =从启动 期间关闭 期间为true的bool,其余时间为False。

有了这些信息,我们可以将您的代码更改为:

if reactor.running:
    # do some work

You do not state which reactor you are using, but this page says ReactorBase is the base class for Reactors.

Also on the same page, it mentions an instance variable running that is further explained here.

It says

running = A bool which is True from during startup to during shutdown and False the rest of the time.

With that information we can change your code to:

if reactor.running:
    # do some work

相关问答

更多
  • 延期就像是未来回报产出的承诺。 你真的应该在这里和这里阅读Deferreds的文档。 另外,你应该一般阅读Python装饰器。 一个介绍在这里 。 更具体地说,发生的情况是,当你调用getProcessOutput()时,结果还没有完全准备好。 它可能在一瞬间或一小时内就绪。 但是你可能不在意:只要准备好了,你可能想要把输出传递给一个函数。 因此,getProcessOutput不是返回输出(不会立即准备好),而是返回一个延迟对象。 当输出终于准备就绪时,延迟对象会通知并调用您提供的任何处理函数,并传递实际 ...
  • 反应器是Maven的一部分,允许它在一组模块上执行目标。 如Maven 1.x 文档中提到的多模块构建 (反应器概念已经在Maven 1.x中),而模块是离散的工作单元,它们可以使用反应器聚集在一起,同时构建它们 : 反应堆根据每个项目在其各自的项目描述符中指定的依赖关系确定正确的构建顺序,然后执行一组规定的目标。 它可以用于建筑项目和其他目标,如站点生成。 如上所述,反应堆是使多模块构建成为可能的:它计算模块之间的依赖关系的有向图,从该图中导出构建顺序(这就是为什么循环依赖不被允许,这是好的),然后执行目 ...
  • Twisted中的所有事件处理程序都在“reactor线程”中运行 - UDP,TCP,实际上是inotify。 他们都希望通过不阻塞来与系统合作。 所以,从这个意义上讲,这只是一个关于如何在Twisted中编写好的事件处理程序的问题,而不是特别关于inotify。 有很多避免阻塞的选项。 回答你的问题棘手的是,正确的选择取决于为什么当前的代码块。 它执行套接字I / O吗? 改为使用Twisted的 非阻塞 套接字I / O API。 它是否执行文件系统I / O? 你可能需要在这里使用一个线程 ,因为非 ...
  • Twisted的反应堆确实无法重启。 如果你想一下它,你就会意识到停止一个事件循环,只是让另一个事件重新启动它,这是违反直觉的。 大多数事件驱动的应用程序都“长时间运行”,除非出现严重错误,否则不应该停止。 不要启动 - 停止 - 重启事件循环。 启动应用程序,然后永远不要重新启动它(你正在制作机器人,所以我认为机器人永远不会睡觉)。 使用CrawlerRunner而不是CrawlerProcess然后执行CrawlerProcess reactor.run() 。 这样可以提高灵活性,并允许您同时运行更多 ...
  • 从您的协议实现中取出反应堆管理代码。 将其替换为一些事件通知代码,您可以使用它来了解连接何时完成所需的操作。 例如,触发Deferred 。 然后等待所有延期,并在完成所有工作后停止反应堆。 您可能会发现gatherResults有帮助。 Take your reactor-management code out of your protocol implementation. Replace it with some event-notification code that you can use to ...
  • 你没有说明你正在使用哪个反应堆,但是这个页面说ReactorBase是反应堆的基类。 同样在同一页面上,它提到了一个实例变量的running , 这里会进一步解释。 它说 running =从启动 期间到关闭 期间为true的bool,其余时间为False。 有了这些信息,我们可以将您的代码更改为: if reactor.running: # do some work You do not state which reactor you are using, but this page says ...
  • 我发现这段代码有几个导入的文件,这些文件位于我没有检查的另一个目录中。 我还假设了这个代码块的目的。 我期望这个功能是任意的,并且每个比赛延迟n秒,但实际上它只在玩家忘记游戏并且没有出现时才实现延迟。 一旦我检查了正确的文件,这些事实就清楚了。 学过的知识。 看看所有的进口! I have discovered that this code has several imported files that were in another directory that I did not examine. I ...
  • 一般来说,异步代码在实时解释器中运行会很麻烦。 最好只在后台运行异步脚本,并在单独的解释器中执行iPython的操作。 您可以使用文件或TCP进行相互通信。 如果这超过了你的头,那是因为它并不总是很简单,最好避免可能的麻烦。 但是,您会很高兴知道在非异步应用程序中使用Twisted有一个很棒的项目叫crochet 。 它确实是我最喜欢的模块之一,我很震惊它没有被更广泛地使用(你可以改变它; D虽然)。 crochet模块有一个run_in_reactor装饰器,它在由crochet的单独线程中运行一个Twi ...
  • joefis的答案基本上是合理的,但我敢打赌一些例子会有所帮助。 首先,有几种方法可以在反应堆启动后立即运行一些代码。 这个很简单: def f(): print "the reactor is running now" reactor.callWhenRunning(f) 另一种方法是使用定时事件,虽然可能没有理由这样做而不是使用callWhenRunning : reactor.callLater(0, f) 您还可以使用底层API,其中callWhenRunning是按callWhenR ...
  • 您无法重新启动反应堆,但您应该能够通过分支单独的进程运行它多次: import scrapy import scrapy.crawler as crawler from multiprocessing import Process, Queue from twisted.internet import reactor # your spider class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = ['http:// ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)